home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / obfuscit.zip / OBFUSCIT.C
Internet Message Format  |  1979-12-31  |  108KB

  1. Path: killer!osu-cis!tut.cis.ohio-state.edu!rutgers!gatech!bbn!bbn.com!rsalz
  2. From: rsalz@uunet.uu.net (Rich Salz)
  3. Newsgroups: comp.sources.unix,comp.lang.c
  4. Subject: v15i105:  International Obfuscated C Code Contest, Part01/07
  5. Message-ID: <1008@fig.bbn.com>
  6. Date: 2 Aug 88 20:36:47 GMT
  7. Lines: 34
  8. Approved: rsalz@uunet.UU.NET
  9. Xref: killer comp.sources.unix:634 comp.lang.c:11603
  10.  
  11. Submitted-by: Landon Curt Noll <chongo@uts.amdahl.com>
  12. Posting-number: Volume 15, Issue 105
  13. Archive-name: ioccc/part01
  14.  
  15. Last year, the complete set of winners were posted because of the new
  16. presentation method. (makefiles, hint files, etc...)  We received a
  17. number of comments/suggestions/flames that result in a number of
  18. small changes all over the place.  The result is a much improved
  19. set of winners.
  20.  
  21. I would like to repost the complete set of winners again.  I doubt
  22. that a reposting of all years will be needed in the future, just
  23. a year by year change.
  24.  
  25. I think a note of the form:
  26.  
  27.     This posting contains a number of editorial and technical
  28.     corrections.  Replace previous International Obfuscated C 
  29.     Code Contest sources with these sources.
  30.  
  31. would be useful at the top of the README, 198{4,5,6,7} artciles.
  32. The 1988 artcile file could have a note of the form:
  33.  
  34.     The rules for 1989 will be posted in beginning of March 1989 to
  35.     the following groups: comp.lang.c & comp.unix.wizards.  Please
  36.     wait until the 1989 rules are posted before sending in new
  37.     entries as the rules change slightly from year to year.
  38.  
  39. Shar files follow.
  40.  
  41. chongo /\oo/\
  42.  
  43. -- 
  44. Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
  45. Path: killer!osu-cis!tut.cis.ohio-state.edu!rutgers!gatech!bbn!bbn.com!rsalz
  46. From: rsalz@uunet.uu.net (Rich Salz)
  47. Newsgroups: comp.sources.unix,comp.lang.c
  48. Subject: v15i106:  International Obfuscated C Code Contest, Part02/07
  49. Message-ID: <1009@fig.bbn.com>
  50. Date: 2 Aug 88 20:37:35 GMT
  51. Lines: 260
  52. Approved: rsalz@uunet.UU.NET
  53. Xref: killer comp.sources.unix:635 comp.lang.c:11604
  54.  
  55. Submitted-by: Landon Curt Noll <chongo@uts.amdahl.com>
  56. Posting-number: Volume 15, Issue 106
  57. Archive-name: ioccc/part02
  58.  
  59. # This is a shell archive.  Remove anything before this line, then
  60. # unpack it by saving it in a file and typing "sh file".  (Files
  61. # unpacked will be owned by you and have default permissions.)
  62. #
  63. # This archive contains:
  64. # ./README ./Makefile
  65. mkdir 1984 1985 1986 1987 1988
  66. echo x - ./README
  67. sed -e 's/^X//' > "./README" << '//E*O*F ./README//'
  68. X               The International Obfuscated C Code Contest
  69. XObfuscate:  tr.v.  -cated, -cating, -cates.  1. a.  To render obscure.
  70. X        b.  To darken.  2. To confuse:  His emotions obfuscated his
  71. X        judgement.  [LLat. obfuscare, to darken : ob(intensive) +
  72. X        Lat. fuscare, to darken < fuscus, dark.] -obfuscation n.
  73. X        obfuscatory adj.
  74. X
  75. X
  76. X
  77. XHow it was started:
  78. X
  79. XThe original inspiration of the International Obfuscated C Code
  80. XContest came from the Bourne Shell source and the finger command as
  81. Xdistributed in 4.2BSD.  If this is what could result from what some
  82. Xpeople claim is reasonable programming practice, then to what depths
  83. Xmight quality sink if people really tried to write poor code?
  84. X
  85. XI put that question to the USENET news groups net.lang.c and
  86. Xnet.unix-wizards in the form of a contest.  I selected a form similar
  87. Xto the contest (Bulwer-Lytton) that asks people to create the worst
  88. Xopening line to a novel.  (that contest in turn was inspired by disgust
  89. Xover a novel that opened with the line "It was a dark and stormy
  90. Xnight.")  The rules were simple: write, in 512 bytes or less, the worst
  91. Xcomplete C program.
  92. X
  93. XThru the contest I have tried to instill two things in people.  First
  94. Xis a disgust for poor coding style.  Second was the notion of just how
  95. Xmuch utility is lost when a program is written in an unstructured
  96. Xfashion.  Contest winners help do this by what I call satirical
  97. Xprogramming.  To see why, observe one of the definitions of satire:
  98. X
  99. X    Keen or energetic activity of the mind used for the purpose 
  100. X    of exposing and discrediting vice or folly.
  101. X
  102. XThe authors of the winning entries placed a great deal of thought into
  103. Xtheir programs.  These programs in turn exposed and discredited what I
  104. Xconsidered to be the programmer's equivalent of "vice or folly".
  105. X
  106. XThere were two unexpected benefits that came from the contest winners.
  107. XFirst was an educational value to the programs.  To understand these C
  108. Xprograms is to understand subtle points of the C programming language.
  109. XThe second benefit is the entertainment value, which should become
  110. Xevident as you read further!
  111. X
  112. X
  113. X
  114. XSuggestions on how to understand the winning entries:
  115. X
  116. XYou are strongly urged to try to determine what each program will
  117. Xproduce by visual inspection.  Often this is an impossible task, but
  118. Xthe difficulty that you encounter should give you more appreciation
  119. Xfor the entry.
  120. X
  121. XIf you have the energy to type in the text, or if you have access to
  122. Xa machine readable version of these programs, you should next consider
  123. Xsome preprocessing such as:
  124. X
  125. X    sed -e '/^#.*include/d' program.c | cc -E
  126. X
  127. XThis strips away comments and expands the program's macros without
  128. Xhaving things such as <stdio.h> macros clutter up the output.  If the
  129. Xentry requires or suggests the use of compile line options (such as
  130. X-Dindex=strchr) they should be added after the '-E' flag.
  131. X
  132. XThe next stage towards understanding is to use a C beautifier or C
  133. Xindenting program on the source.  Be warned that a number of these
  134. Xentries are so twisted that such tools may abort or become very
  135. Xconfused.  You may need to help out by doing some initial formatting
  136. Xwith an editor.  You might also try renaming variables and labels to
  137. Xgive more meaningful names.
  138. X
  139. XNow try linting the program.  You may be surprised at how little lint
  140. Xcomplains about these programs.  Pay careful attention to messages
  141. Xabout unused variables, wrong types, pointer conversions, etc.  But be
  142. Xcareful, some lints produce incorrect error messages or even abort!
  143. XYour lint may detect syntax errors in the source.  See the next
  144. Xparagraph for suggestions on how to deal with this.
  145. X
  146. XWhen you get to the stage where you are ready to compile the program
  147. Xexamine the compilation comments above each entry.  A simple define or
  148. Xedit may be required due to differing semantics between operating
  149. Xsystems.  If you are able to successfully compile the program,
  150. Xexperiment with it by giving it different arguments or input.
  151. XYou may also use the makefile provided to compile the program.
  152. XKeep in mind that C compilers often have bugs, or features which
  153. Xresult the program failing to compile.  You may have to do some
  154. Xsyntax changing as we did to get old programs to compile on strict
  155. XANSI C compilers.
  156. X
  157. XLast, read the judges' comments/spoilers on the program.  Hints
  158. Xfor `foo.c' are given in `foo.hint'.  Often they will contain suggested
  159. Xarguments or recommended data to use.
  160. X
  161. XIf you do gain some understanding of how a program works, go back to
  162. Xthe source and reexamine it using some of the techniques outlined above.
  163. XSee if you can convince yourself of why the program does what it does.
  164. X
  165. X
  166. X
  167. XAbout the judges:
  168. X
  169. XAs of 1988 the contest had two judges: Landon Curt Noll (contest
  170. Xfounder) and Larry Bassel (judge since 1985).  Landon works as a
  171. Xsystems programmer for Amdahl Corporation and Larry works as an systems
  172. Xprogrammer for Sun Microsystems.  In real life, both judges strongly
  173. Xdislike obfuscated code.
  174. X
  175. X
  176. X
  177. XRegarding the source archive:
  178. X
  179. XEach sub-directory contains all the entries for a single year.  Often
  180. Xthe file names match one of the last names of the author.  Judges'
  181. Xhints are given in files of the form ``*.hint''.  The makefiles
  182. Xgiven are set up for a System V based machine.  You may need to
  183. Xtweak this makefile to get everything to compile correctly.
  184. XRead the hint files for suggestions.  The rules for a given
  185. Xyear are given in the file named ``rules''.  The last year
  186. Xin an archive contains a copy of the rules for the upcoming
  187. Xcontest.
  188. X
  189. X
  190. X
  191. XRegarding the distribution of sources:
  192. X
  193. XAll contest results are in the public domain.  We do ask that you observe 
  194. Xthe following request:
  195. X
  196. XYou may shar these files with others, but please do not prevent them of
  197. Xdoing the same.  If some of these files and/or contest entries are
  198. Xpublished in printed form, or if you use them in a business or classroom
  199. Xsetting, please let us know.  We ask that you drop a line to the
  200. X'judges' Email box.  As of 1988, it is:
  201. X
  202. X    judges@uts.amdahl.com    -or-    amdahl!judges
  203. X
  204. X    [this could change from year to year, so consult the current rules]
  205. X
  206. X
  207. X
  208. XSome final things to remember:
  209. X
  210. XWhile the idea for the contests has remained the same through the
  211. Xyears, the contest rules and guidelines vary.  What was novel one year
  212. Xmay be considered common the next.  The categories for awards differ
  213. Xbecause they are determined after the judges examine all of the
  214. Xentries.
  215. X
  216. XThe judges' hints assume that the program resides in a file with the
  217. Xsame username as the author.  Where there is more than one author, the
  218. Xfirst named author is used.
  219. X
  220. XSome C compilers are unable to compile some of these programs.  The
  221. Xjudges tried to select programs that were widely portable and
  222. Xcompilable, but did not always succeed.  As of 1988, only ``K&R''
  223. Xcompilers were used.  Due to the timing of the ANSI C standard, ANSI C
  224. Xissues were not addressed until 1988 at all (and in 1988 there were
  225. Xjust a few comments in the hint files).  Often only a simple edit is
  226. Xneeded to get a new C compiler to accept the source file.
  227. X
  228. XThe contest rules are posted in early March.  The winners are announced
  229. Xat the Usenet BOF of the Summer Usenix conference.  Later they
  230. Xare posted to the net.
  231. X
  232. XThe rules are posted to the following Usenet news groups:
  233. X
  234. X    comp.unix.wizards
  235. X    comp.lang.c        
  236. X
  237. XAs of 1988, the winners were posted to the following Usenet news groups:
  238. X
  239. X    comp.sources.unix        
  240. X    comp.lang.c        
  241. X    alt.sources    
  242. X
  243. XPeople are strongly encouraged to wait until the new contest rules
  244. Xhave been posted before sending entries.  The rules, and sometimes
  245. Xthe contest Email address itself, change from time to time.
  246. XThe typical start date for a contest is March 15.  The typical
  247. Xend date for a contest is May 20.
  248. X
  249. XLast, PLEASE don't code in the style of these programs (unless you
  250. Xare submitting a contest entry of course!)  It is hoped that you will
  251. Xgain an understanding that bad style destroys an otherwise correct
  252. Xprogram.  Real programmers don't write obfuscated programs that other
  253. Xpeople have to use!
  254. X
  255. XHappy pondering,
  256. X
  257. X    Landon Curt Noll   (chongo@uts.amdahl.com)
  258. X    Larry Bassel       (lab@sun.com)
  259. //E*O*F ./README//
  260.  
  261. echo x - ./Makefile
  262. sed -e 's/^X//' > "./Makefile" << '//E*O*F ./Makefile//'
  263. X# %W% %G% %U%
  264. X#
  265. X
  266. XSHELL=/bin/sh
  267. X
  268. Xall:
  269. X    @-for i in [12][0-9][0-9]?; do \
  270. X        if [ -f $$i/[Mm]akefile ]; then \
  271. X        echo "cd $$i; make all"; \
  272. X        (cd $$i; make all); \
  273. X        fi; \
  274. X    done
  275. X
  276. Xclean:
  277. X    @-for i in [12][0-9][0-9]?; do \
  278. X        if [ -f $$i/[Mm]akefile ]; then \
  279. X        echo "cd $$i; make clean"; \
  280. X        (cd $$i; make clean); \
  281. X        fi; \
  282. X    done
  283. Xclobber:
  284. X    @-for i in [12][0-9][0-9]?; do \
  285. X        if [ -f $$i/[Mm]akefile ]; then \
  286. X        echo "cd $$i; make clobber"; \
  287. X        (cd $$i; make clobber); \
  288. X        fi; \
  289. X    done
  290. Xinstall:
  291. X    @-for i in [12][0-9][0-9]?; do \
  292. X        if [ -f $$i/[Mm]akefile ]; then \
  293. X        echo "cd $$i; make install"; \
  294. X        (cd $$i; make install); \
  295. X        fi; \
  296. X    done
  297. //E*O*F ./Makefile//
  298.  
  299. echo Possible errors detected by \'wc\' [hopefully none]:
  300. temp=/tmp/shar$$
  301. trap "rm -f $temp; exit" 0 1 2 3 15
  302. cat > $temp <<\!!!
  303.  193  1346  8065  README
  304.  34  118  655  Makefile
  305.  227  1464  8720  total
  306. !!!
  307. wc  ./README ./Makefile | sed 's=[^ ]*/==' | diff -b $temp -
  308. exit 0
  309.  
  310. -- 
  311. Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
  312. Path: killer!osu-cis!tut.cis.ohio-state.edu!rutgers!gatech!bbn!bbn.com!rsalz
  313. From: rsalz@uunet.uu.net (Rich Salz)
  314. Newsgroups: comp.sources.unix,comp.lang.c
  315. Subject: v15i107:  International Obfuscated C Code Contest, Part03/07
  316. Message-ID: <1010@fig.bbn.com>
  317. Date: 2 Aug 88 20:38:22 GMT
  318. Lines: 276
  319. Approved: rsalz@uunet.UU.NET
  320. Xref: killer comp.sources.unix:636 comp.lang.c:11605
  321.  
  322. Submitted-by: Landon Curt Noll <chongo@uts.amdahl.com>
  323. Posting-number: Volume 15, Issue 107
  324. Archive-name: ioccc/part03
  325.  
  326. # This is a shell archive.  Remove anything before this line, then
  327. # unpack it by saving it in a file and typing "sh file".  (Files
  328. # unpacked will be owned by you and have default permissions.)
  329. #
  330. # This archive contains:
  331. # ./1984/Makefile ./1984/README ./1984/anonymous.c ./1984/anonymous.hint
  332. # ./1984/decot.c ./1984/decot.hint ./1984/laman.c ./1984/laman.hint
  333. # ./1984/mullender.c ./1984/mullender.hint ./1984/rules
  334.  
  335. echo x - ./1984/Makefile
  336. sed -e 's/^X//' > "./1984/Makefile" << '//E*O*F ./1984/Makefile//'
  337. X# %W% %G% %U%
  338. X#
  339. X# 1984 makefile
  340. X
  341. XSHELL=/bin/sh
  342. XWINNERS=anonymous laman decot mullender
  343. X
  344. Xall: ${WINNERS}
  345. X
  346. Xanonymous: anonymous.c
  347. X    cc $? -o $@
  348. Xlaman: laman.c
  349. X    cc $? -o $@
  350. Xdecot: decot.c
  351. X    cc $? -o $@ -lm
  352. Xmullender: mullender.c
  353. X    cc $? -o $@
  354. X
  355. Xclean:
  356. X    rm -f core
  357. Xclobber: clean
  358. X    rm -f ${WINNERS}
  359. X
  360. Xinstall: all
  361. X    @echo are you kidding'??'
  362. //E*O*F ./1984/Makefile//
  363.  
  364. echo x - ./1984/README
  365. sed -e 's/^X//' > "./1984/README" << '//E*O*F ./1984/README//'
  366. XIn 1984, the first contest was held.  The name of the contest was simply
  367. X``Obfuscated C Code Contest''.
  368. X
  369. XRestrictions against machine dependent code were not in the rules in 1984.
  370. XThe source file size restriction was only 512 bytes.  Rules and results
  371. Xwere posted to net.lang.c and net.unix-wizards.
  372. //E*O*F ./1984/README//
  373.  
  374. echo x - ./1984/anonymous.c
  375. sed -e 's/^X//' > "./1984/anonymous.c" << '//E*O*F ./1984/anonymous.c//'
  376. Xint i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\
  377. Xo, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}
  378. //E*O*F ./1984/anonymous.c//
  379.  
  380. echo x - ./1984/anonymous.hint
  381. sed -e 's/^X//' > "./1984/anonymous.hint" << '//E*O*F ./1984/anonymous.hint//'
  382. XAnonymous entry: <?!?> Dishonorable mention
  383. X
  384. XThe author was too embarrassed that he/she could write such trash, so I
  385. Xpromised to protect their identity.  I will say that the author of this
  386. Xprogram has a well known connection with the C programming language.
  387. X
  388. XThis program is a unique variation on the age old "Hello, world"
  389. Xprogram.  What reads like a read may be written like a write!
  390. //E*O*F ./1984/anonymous.hint//
  391.  
  392. echo x - ./1984/decot.c
  393. sed -e 's/^X//' > "./1984/decot.c" << '//E*O*F ./1984/decot.c//'
  394. X#define x =
  395. X#define double(a,b) int
  396. X#define char k['a']
  397. X#define union static struct
  398. X
  399. Xextern int floor;
  400. Xdouble (x1, y1) b,
  401. Xchar x {sizeof(
  402. X    double(%s,%D)(*)())
  403. X,};
  404. Xstruct tag{int x0,*xO;}
  405. X
  406. X*main(i, dup, signal) {
  407. X{
  408. X  for(signal=0;*k *x * __FILE__ *i;) do {
  409. X   (printf(&*"'\",x);    /*\n\\", (*((double(tag,u)(*)())&floor))(i)));
  410. X    goto _0;
  411. X
  412. X_O: while (!(char <<x - dup)) {    /*/*\*/
  413. X    union tag u x{4};
  414. X  }
  415. X}
  416. X
  417. X
  418. Xwhile(b x 3, i); {
  419. Xchar x b,i;
  420. X  _0:if(b&&k+
  421. X  sin(signal)        / *    ((main) (b)-> xO));/*}
  422. X  ;
  423. X}
  424. X
  425. X*/}}}
  426. //E*O*F ./1984/decot.c//
  427.  
  428. echo x - ./1984/decot.hint
  429. sed -e 's/^X//' > "./1984/decot.hint" << '//E*O*F ./1984/decot.hint//'
  430. XSecond place award: <hpda!hpdsd!decot> Dave Decot
  431. X
  432. XCompile with:
  433. X
  434. X    cc decot.c -o decot -lm
  435. X
  436. XNOTE: Some new compilers disliked line 15 of the source, so we changed it from:
  437. X
  438. X  for(signal=0;*k * x * __FILE__ *i;) do {
  439. X
  440. Xto:
  441. X
  442. X  for(signal=0;*k *x * __FILE__ *i;) do {
  443. X
  444. XThis program prints out a string of garbage.
  445. X
  446. XThe judges also offer this one comment: understand comments!
  447. //E*O*F ./1984/decot.hint//
  448.  
  449. echo x - ./1984/laman.c
  450. sed -e 's/^X//' > "./1984/laman.c" << '//E*O*F ./1984/laman.c//'
  451. Xa[900];        b;c;d=1        ;e=1;f;        g;h;O;        main(k,
  452. Xl)char*        *l;{g=        atoi(*        ++l);        for(k=
  453. X0;k*k<        g;b=k        ++>>1)        ;for(h=        0;h*h<=
  454. Xg;++h);        --h;c=(        (h+=g>h        *(h+1))        -1)>>1;
  455. Xwhile(d        <=g){        ++O;for        (f=0;f<        O&&d<=g
  456. X;++f)a[        b<<5|c]        =d++,b+=    e;for(        f=0;f<O
  457. X&&d<=g;        ++f)a[b        <<5|c]=        d++,c+=        e;e= -e
  458. X;}for(c        =0;c<h;        ++c){        for(b=0        ;b<k;++
  459. Xb){if(b        <k/2)a[        b<<5|c]        ^=a[(k        -(b+1))
  460. X<<5|c]^=    a[b<<5        |c]^=a[        (k-(b+1        ))<<5|c]
  461. X;printf(    a[b<<5|c    ]?"%-4d"    :"    "        ,a[b<<5
  462. X|c]);}        putchar(    '\n');}}    /*Mike        Laman*/
  463. //E*O*F ./1984/laman.c//
  464.  
  465. echo x - ./1984/laman.hint
  466. sed -e 's/^X//' > "./1984/laman.hint" << '//E*O*F ./1984/laman.hint//'
  467. XThird place: <sdcsvax!laman> Mike Laman
  468. X
  469. XNOTE: Some new compilers dislike lines 6 and 10 of the source, so we changed
  470. Xthem from:
  471. X
  472. X;++f)a[        b<<5|c]        =d++,b+        =e;for(        f=0;f<O
  473. X<<5|c]^        =a[b<<5        |c]^=a[        (k-(b+1        ))<<5|c]
  474. X
  475. Xto:
  476. X
  477. X;++f)a[        b<<5|c]        =d++,b+=    e;for(        f=0;f<O
  478. X<<5|c]^=    a[b<<5        |c]^=a[        (k-(b+1        ))<<5|c]
  479. X
  480. XI hope you have the C beautifier! The program accepts ONE positive
  481. Xargument.  Seeing is believing, so try things like:
  482. X
  483. X    laman 4
  484. X    laman 9
  485. X    laman 16
  486. X
  487. XThis code should run you in circles.
  488. //E*O*F ./1984/laman.hint//
  489.  
  490. echo x - ./1984/mullender.c
  491. sed -e 's/^X//' > "./1984/mullender.c" << '//E*O*F ./1984/mullender.c//'
  492. Xshort main[] = {
  493. X    277, 04735, -4129, 25, 0, 477, 1019, 0xbef, 0, 12800,
  494. X    -113, 21119, 0x52d7, -1006, -7151, 0, 0x4bc, 020004,
  495. X    14880, 10541, 2056, 04010, 4548, 3044, -6716, 0x9,
  496. X    4407, 6, 5568, 1, -30460, 0, 0x9, 5570, 512, -30419,
  497. X    0x7e82, 0760, 6, 0, 4, 02400, 15, 0, 4, 1280, 4, 0,
  498. X    4, 0, 0, 0, 0x8, 0, 4, 0, ',', 0, 12, 0, 4, 0, '#',
  499. X    0, 020, 0, 4, 0, 30, 0, 026, 0, 0x6176, 120, 25712,
  500. X    'p', 072163, 'r', 29303, 29801, 'e'
  501. X};
  502. //E*O*F ./1984/mullender.c//
  503.  
  504. echo x - ./1984/mullender.hint
  505. sed -e 's/^X//' > "./1984/mullender.hint" << '//E*O*F ./1984/mullender.hint//'
  506. XThe Grand Prize: <vu44!{sjoerd,cogito}> Sjoerd Mullender & Robbert van Renesse
  507. X
  508. XWithout question, this C program is the most obfuscated C program that
  509. Xhas ever been received!  Like all great contest entries, they result
  510. Xin a change of rules for the following year.  To prevent a flood of
  511. Xsimilar programs, we requested that programs be non machine specific.
  512. X
  513. XThis program was selected for the 1987 t-shirt collection.
  514. X
  515. XNOTE: If your machine is not a Vax-11 or pdp-11, this program will
  516. X      not execute correctly.  In later years, machine dependent
  517. X      code was discouraged.
  518. X
  519. XThe C startup routine (via crt0.o) transfers control to a location
  520. Xnamed main.  In this case, main just happens to be in the data area.
  521. XThe array of shorts, which has been further obfuscated by use of
  522. Xdifferent data types, just happens to form a meaningful set of PDP-11
  523. Xand Vax instructions.  The first word is a PDP-11 branch instruction
  524. Xthat branches to the rest of the PDP code.  On the Vax main is called with
  525. Xthe calls instruction which uses the first word of the subroutine as a
  526. Xmask of registers to be saved.  So on the Vax the first word can be anything.
  527. XThe real Vax code starts with the second word.  This small program
  528. Xmakes direct calls to the write() Unix system call to produce a
  529. Xmessage on the screen.  Can you guess what is printed?  We knew you
  530. Xcouldn't!  :-)
  531. //E*O*F ./1984/mullender.hint//
  532.  
  533. echo x - ./1984/rules
  534. sed -e 's/^X//' > "./1984/rules" << '//E*O*F ./1984/rules//'
  535. XI'm sure you have all seen gross, or down right structurally obscene C
  536. Xsource code before.  Some people who deal with various parts of the
  537. XUN*X  source wonder if some folks try rather hard to produce such
  538. Xdown right smelly code.
  539. X
  540. XNow you have the chance to compete with the worst C hackers around
  541. Xby sending in your own obfuscated C program.  Just follow the contest
  542. Xrules below:
  543. X        1) the source file must be no more than 512 bytes long
  544. X
  545. X        2) mail your source to:    hplabs!nsc!chongo
  546. X           no later than April 11, 1984.  entries posted to
  547. X           the net will NOT be accepted.  please give your
  548. X           letter the subject of: obfuscated C code contest.
  549. X
  550. X        3) winning entries will be posted to net.lang.c after
  551. X           April 12, 1894.  (thats the prize folks)
  552. X
  553. X        4) indicate your net address in the text of your
  554. X           entry, this will be used to give credit unless
  555. X           you indicate that you want to remain anonymous.
  556. X
  557. X        5) entries must be of original work.  (dont send anything
  558. X           that might upset Big Brother Bell)  all entries are
  559. X           public domain.  (who would want to own them anyway?!)
  560. X
  561. XEntries will be judged for: violations of structured programming, non-clarity,
  562. Xand use of "by the K&R book" C. (use of local mods to C are not encouraged)
  563. Xextra credit if they can be compiled using the 4.2BSD C compiler on our VAX 780,
  564. Xbut dont let the lack of a 780 or 4.2 discourage you!
  565. X
  566. Xchongo <flames about the contest will be kindly #ifdef'ed out> /\CC/\
  567. X
  568. XUN*X is a trademark of Usenet Hackers Anonymous
  569. X
  570. XWARNING: The rules and mailing address for the contest change from year
  571. X         to year.  Be sure that you consult the current set of rules
  572. X     before submitting entries.
  573. //E*O*F ./1984/rules//
  574.  
  575. echo Possible errors detected by \'wc\' [hopefully none]:
  576. temp=/tmp/shar$$
  577. trap "rm -f $temp; exit" 0 1 2 3 15
  578. cat > $temp <<\!!!
  579.  25  55  331  Makefile
  580.  6  48  300  README
  581.  2  4  123  anonymous.c
  582.  8  66  386  anonymous.hint
  583.  32  77  509  decot.c
  584.  17  61  372  decot.hint
  585.  12  62  510  laman.c
  586.  21  76  499  laman.hint
  587.  10  86  431  mullender.c
  588.  25  234  1357  mullender.hint
  589.  38  284  1666  rules
  590.  196  1053  6484  total
  591. !!!
  592. wc  ./1984/Makefile ./1984/README ./1984/anonymous.c ./1984/anonymous.hint ./1984/decot.c ./1984/decot.hint ./1984/laman.c ./1984/laman.hint ./1984/mullender.c ./1984/mullender.hint ./1984/rules | sed 's=[^ ]*/==' | diff -b $temp -
  593. exit 0
  594.  
  595. -- 
  596. Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
  597. Path: killer!osu-cis!tut.cis.ohio-state.edu!rutgers!gatech!bbn!bbn.com!rsalz
  598. From: rsalz@bbn.com (Rich Salz)
  599. Newsgroups: comp.sources.unix,comp.lang.c
  600. Subject: v15i108:  International Obfuscated C Code Contest, Part04/07
  601. Message-ID: <1011@fig.bbn.com>
  602. Date: 2 Aug 88 20:39:05 GMT
  603. Organization: BBN Laboratories Inc., Cambridge MA
  604. Lines: 281
  605. Approved: rsalz@uunet.UU.NET
  606. Xref: killer comp.sources.unix:637 comp.lang.c:11606
  607.  
  608. Submitted-by: Landon Curt Noll <chongo@uts.amdahl.com>
  609. Posting-number: Volume 15, Issue 108
  610. Archive-name: ioccc/part04
  611.  
  612. # This is a shell archive.  Remove anything before this line, then
  613. # unpack it by saving it in a file and typing "sh file".  (Files
  614. # unpacked will be owned by you and have default permissions.)
  615. #
  616. # This archive contains:
  617. # ./1985/Makefile ./1985/README ./1985/applin.c ./1985/applin.hint
  618. # ./1985/august.c ./1985/august.hint ./1985/lycklama.c
  619. # ./1985/lycklama.hint ./1985/rules ./1985/shapiro.c ./1985/shapiro.hint
  620. # ./1985/sicherman.c ./1985/sicherman.hint
  621.  
  622. echo x - ./1985/Makefile
  623. sed -e 's/^X//' > "./1985/Makefile" << '//E*O*F ./1985/Makefile//'
  624. X# %W% %G% %U%
  625. X#
  626. X# 1985 makefile
  627. X
  628. XSHELL=/bin/sh
  629. XWINNERS= applin august lycklama shapiro sicherman
  630. X
  631. Xall: ${WINNERS}
  632. X
  633. Xapplin: applin.c
  634. X    cc $? -o $@
  635. Xaugust: august.c
  636. X    cc $? -o $@
  637. Xlycklama: lycklama.c
  638. X    cc $? -o $@
  639. Xshaprio: shaprio.c
  640. X    cc $? -o $@
  641. Xscherman: sicherman.c
  642. X    cc $? -o $@
  643. X
  644. Xclean:
  645. X    rm -f core
  646. Xclobber: clean
  647. X    rm -f ${WINNERS}
  648. X
  649. Xinstall: all
  650. X    @echo are you kidding'??'
  651. //E*O*F ./1985/Makefile//
  652.  
  653. echo x - ./1985/README
  654. sed -e 's/^X//' > "./1985/README" << '//E*O*F ./1985/README//'
  655. XIn 1985, the second Obfuscated C Code Contest was held.  Hints against
  656. Xmachine dependent code were added to the rules to avoid another 1984
  657. Xstyle winner.  Rules and results were posted to net.lang.c and
  658. Xnet.unix-wizards.  Larry Bassel was invited to help in the judging.
  659. XAwards were given to 5 classes of programs since we were unable to
  660. Xselect only the best 4.
  661. //E*O*F ./1985/README//
  662.  
  663. echo x - ./1985/applin.c
  664. sed -e 's/^X//' > "./1985/applin.c" << '//E*O*F ./1985/applin.c//'
  665. Xmain(v,c)char**c;{for(v[c++]="Hello, world!\n)";(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)write(!!*c,*c,!!**c);}
  666. //E*O*F ./1985/applin.c//
  667.  
  668. echo x - ./1985/applin.hint
  669. sed -e 's/^X//' > "./1985/applin.hint" << '//E*O*F ./1985/applin.hint//'
  670. XBest one liner: <hp-dcd!jack> Jack Applin [with help from Robert Heckendorn]
  671. X
  672. XOne liner programs are short but twisted.  This "Hello, World" version
  673. Xcertainly takes its time saying hello.
  674. //E*O*F ./1985/applin.hint//
  675.  
  676. echo x - ./1985/august.c
  677. sed -e 's/^X//' > "./1985/august.c" << '//E*O*F ./1985/august.c//'
  678. X#define p struct c
  679. X#define q struct b
  680. X#define h a->a
  681. X#define i a->b
  682. X#define e i->c
  683. X#define o a=(*b->a)(b->b,b->c)
  684. X#define s return a;}q*
  685. X#define n (d,b)p*b;{q*a;p*c;
  686. X#define z(t)(t*)malloc(sizeof(t))
  687. Xq{int a;p{q*(*a)();int b;p*c;}*b;};q*u n a=z(q);h=d;i=z(p);i->a=u;i->b=d+1;s
  688. Xv n c=b;do o,b=i;while(!(h%d));i=c;i->a=v;i->b=d;e=b;s
  689. Xw n o;c=i;i=b;i->a=w;e=z(p);e->a=v;e->b=h;e->c=c;s
  690. Xt n for(;;)o,main(-h),b=i;}main(b){p*a;if(b>0)a=z(p),h=w,a->c=z(p),a->c->a=u,
  691. Xa->c->b=2,t(0,a);putchar(b?main(b/2),-b%2+'0':10);}
  692. //E*O*F ./1985/august.c//
  693.  
  694. echo x - ./1985/august.hint
  695. sed -e 's/^X//' > "./1985/august.hint" << '//E*O*F ./1985/august.hint//'
  696. XThe most obscure program<chalmers!augustss>: Lennart Augustsson
  697. X
  698. XAn interesting use of a recursive call to main.  Compile and execute
  699. Xwithout args.  What is the initial value of b, and does it alter the
  700. Xaction of the program?
  701. X
  702. XIf you let it, the program will continue to print a numerical sequence
  703. X(can you guess in what base it is printed?) until you run out of
  704. Xmemory or until they sell your computer, which ever comes first.
  705. //E*O*F ./1985/august.hint//
  706.  
  707. echo x - ./1985/lycklama.c
  708. sed -e 's/^X//' > "./1985/lycklama.c" << '//E*O*F ./1985/lycklama.c//'
  709. X#define o define
  710. X#o ___o write
  711. X#o ooo (unsigned)
  712. X#o o_o_ 1
  713. X#o _o_ char
  714. X#o _oo goto
  715. X#o _oo_ read
  716. X#o o_o for
  717. X#o o_ main
  718. X#o o__ if
  719. X#o oo_ 0
  720. X#o _o(_,__,___)(void)___o(_,__,ooo(___))
  721. X#o __o (o_o_<<((o_o_<<(o_o_<<o_o_))+(o_o_<<o_o_)))+(o_o_<<(o_o_<<(o_o_<<o_o_)))
  722. Xo_(){_o_ _=oo_,__,___,____[__o];_oo ______;_____:___=__o-o_o_; _______:
  723. X_o(o_o_,____,__=(_-o_o_<___?_-o_o_:___));o_o(;__;_o(o_o_,"\b",o_o_),__--);
  724. X_o(o_o_," ",o_o_);o__(--___)_oo _______;_o(o_o_,"\n",o_o_);______:o__(_=_oo_(
  725. Xoo_,____,__o))_oo _____;}
  726. //E*O*F ./1985/lycklama.c//
  727.  
  728. echo x - ./1985/lycklama.hint
  729. sed -e 's/^X//' > "./1985/lycklama.hint" << '//E*O*F ./1985/lycklama.hint//'
  730. XThe strangest appearing program: <ism780!ed> Ed Lycklama
  731. X
  732. XRun the program without any arguments.  Type in some very long lines
  733. Xand notice how it redisplays it.
  734. X
  735. XThe program itself looks like tty noise.  Notice that even `define' in
  736. X#define can be defined.
  737. //E*O*F ./1985/lycklama.hint//
  738.  
  739. echo x - ./1985/rules
  740. sed -e 's/^X//' > "./1985/rules" << '//E*O*F ./1985/rules//'
  741. XWARNING: The rules and mailing address for the contest change from year
  742. X         to year.  Be sure that you consult the current set of rules
  743. X     before submitting entries.
  744. X--------------------------------------------------------------------------------
  745. X
  746. XIt is time once again for the net wide Obfuscated C code contest!
  747. X
  748. XGOAL:  To write the most Obscure working C program under the rules below:
  749. X
  750. XRULES:    1) The source must be 512 bytes or less.
  751. X    2) Mail your entries to:      ...!ihnp4!nsc!chongo
  752. X       Postings to the net will NOT be used!
  753. X    3) Include at the top of the letter:
  754. X        a) Your name, and path from a major network node.
  755. X           If you want your entry to be anonymous, indicate this as well.
  756. X        b) A brief statement of what the program should do.
  757. X        c) The machine/opsys on which it runs.
  758. X    4) Enclose your source between the following lines:
  759. X---start of program---
  760. X<place obfuscated source here>
  761. X---end of program---
  762. X    5) The C program must be written in common C. 
  763. X       That is, K&R plus common extensions (say 4.2 or Sys V C)
  764. X    6) The program must be of original work.
  765. X    7) The program must be a complete program. (i.e., not just a fragment)
  766. X    8) Entries must be received by me on or before June 8, 1985.
  767. X
  768. XPOINTS:    Each entry will be judged for its non-clarity.  I will attempt to
  769. X    run each of them on a Vax 780/4.2BSD system.   Don't let the lack
  770. X    of such a system stop you!  Try to avoid operating system/machine
  771. X    specific code if you do not have such a system.  Extra points will
  772. X    be given for program that:
  773. X
  774. X    a) Able to pass lint without complaint
  775. X    b) Actually does something interesting  (not just exit)
  776. X    c) are portable (i.e., no special calls of local features)
  777. X       (long variable names will be allowed as needed)
  778. X
  779. XThe names of the winners will be posted to net.lang.c.  The winning
  780. Xsources will be posted to net.sources.
  781. X
  782. XIf you have any questions on the rules/points above, just ask via mail!
  783. X
  784. Xchongo <main(){int i;i+=i+++++i;exit(i);}> /\??/\
  785. //E*O*F ./1985/rules//
  786.  
  787. echo x - ./1985/shapiro.c
  788. sed -e 's/^X//' > "./1985/shapiro.c" << '//E*O*F ./1985/shapiro.c//'
  789. X#define P(X)j=write(1,X,1)
  790. X#define C 39
  791. Xint M[5000]={2},*u=M,N[5000],R=22,a[4],l[]={0,-1,C-1,-1},m[]={1,-C,-1,C},*b=N,
  792. X*d=N,c,e,f,g,i,j,k,s;main(){for(M[i=C*R-1]=24;f|d>=b;){c=M[g=i];i=e;for(s=f=0;
  793. Xs<4;s++)if((k=m[s]+g)>=0&&k<C*R&&l[s]!=k%C&&(!M[k]||!j&&c>=16!=M[k]>=16))a[f++
  794. X]=s;if(f){f=M[e=m[s=a[rand()/(1+2147483647/f)]]+g];j=j<f?f:j;f+=c&-16*!j;M[g]=
  795. Xc|1<<s;M[*d++=e]=f|1<<(s+2)%4;}else e=d>b++?b[-1]:e;}P(" ");for(s=C;--s;P("_")
  796. X)P(" ");for(;P("\n"),R--;P("|"))for(e=C;e--;P("_ "+(*u++/8)%2))P("| "+(*u/4)%2
  797. X);}
  798. //E*O*F ./1985/shapiro.c//
  799.  
  800. echo x - ./1985/shapiro.hint
  801. sed -e 's/^X//' > "./1985/shapiro.hint" << '//E*O*F ./1985/shapiro.hint//'
  802. XGrand prize for most well-rounded in confusion: <otto!carl> Carl Shapiro
  803. X
  804. XAs submitted, this program was 3 lines (2 of defines and 1 of code).
  805. XTo make news & mail happy we split the last line into 7. Join them
  806. Xback without the newlines to get the original version.
  807. X
  808. XThis program was selected for the 1987 t-shirt collection.
  809. X
  810. XWe found this program is be simply aMAZEing!  Run this program without
  811. Xarguments and notice the output.
  812. //E*O*F ./1985/shapiro.hint//
  813.  
  814. echo x - ./1985/sicherman.c
  815. sed -e 's/^X//' > "./1985/sicherman.c" << '//E*O*F ./1985/sicherman.c//'
  816. X#define C_C_(_)~' '&_
  817. X#define _C_C(_)('\b'b'\b'>=C_C>'\t'b'\n')
  818. X#define C_C _|_
  819. X#define b *
  820. X#define C /b/
  821. X#define V _C_C(
  822. Xmain(C,V)
  823. Xchar **V;
  824. X/*    C program. (If you don't
  825. X *    understand it look it
  826. X */    up.) (In the C Manual)
  827. X{
  828. X    char _,__; 
  829. X    while (read(0,&__,1) & write((_=(_=C_C_(__),C)),
  830. X    _C_,1)) _=C-V+subr(&V);
  831. X}
  832. Xsubr(C)
  833. Xchar *C;
  834. X{
  835. X    C="Lint says "argument Manual isn't used."  What's that
  836. X    mean?"; while (write((read(C_C('"'-'/*"'/*"*/))?__:__-_+
  837. X    '\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1));
  838. X}
  839. //E*O*F ./1985/sicherman.c//
  840.  
  841. echo x - ./1985/sicherman.hint
  842. sed -e 's/^X//' > "./1985/sicherman.hint" << '//E*O*F ./1985/sicherman.hint//'
  843. XThe worst abuse of the C preprocessor: <sunybcs!colonel> Col. G. L. Sicherman
  844. X
  845. XThis program abuses the C preprocessor so much that some /lib/cpp's fail to
  846. Xstrip out all of the comments on the first pass!  If you were able to
  847. Xunderstand Decot's entry in 1984, you will have a head start on this
  848. Xone.
  849. X
  850. XBe sure to run this program through lint!  If your lint works
  851. Xcorrectly, it should warn you that the argument `Manual' isn't used.
  852. XLike the program says, what's that mean?
  853. X
  854. XRun the program without arguments and enter the letters 'a' thru 'm'
  855. Xon a line.  Now enter the letters 'n' thru 'z'.  But to borrow a quote
  856. Xfrom Richard Stallman: If you think you understand what this code
  857. Xdoes, then you don't, so read it again!  Explain why:
  858. X
  859. X    sicherman < sicherman.c | sicherman | diff - sicherman.c
  860. X
  861. Xresults in diff reporting a difference on some machines.
  862. //E*O*F ./1985/sicherman.hint//
  863.  
  864. echo Possible errors detected by \'wc\' [hopefully none]:
  865. temp=/tmp/shar$$
  866. trap "rm -f $temp; exit" 0 1 2 3 15
  867. cat > $temp <<\!!!
  868.  27  62  370  Makefile
  869.  6  62  362  README
  870.  1  2  129  applin.c
  871.  4  28  188  applin.hint
  872.  14  45  513  august.c
  873.  9  74  428  august.hint
  874.  17  48  509  lycklama.c
  875.  7  41  256  lycklama.hint
  876.  44  322  1958  rules
  877.  9  18  518  shapiro.c
  878.  10  74  430  shapiro.hint
  879.  23  64  511  sicherman.c
  880.  19  150  850  sicherman.hint
  881.  190  990  7022  total
  882. !!!
  883. wc  ./1985/Makefile ./1985/README ./1985/applin.c ./1985/applin.hint ./1985/august.c ./1985/august.hint ./1985/lycklama.c ./1985/lycklama.hint ./1985/rules ./1985/shapiro.c ./1985/shapiro.hint ./1985/sicherman.c ./1985/sicherman.hint | sed 's=[^ ]*/==' | diff -b $temp -
  884. exit 0
  885.  
  886. -- 
  887. Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
  888. Path: killer!osu-cis!tut.cis.ohio-state.edu!rutgers!gatech!bbn!bbn.com!rsalz
  889. From: rsalz@uunet.uu.net (Rich Salz)
  890. Newsgroups: comp.sources.unix,comp.lang.c
  891. Subject: v15i109:  International Obfuscated C Code Contest, Part05/07
  892. Message-ID: <1012@fig.bbn.com>
  893. Date: 2 Aug 88 20:40:06 GMT
  894. Lines: 672
  895. Approved: rsalz@uunet.UU.NET
  896. Xref: killer comp.sources.unix:638 comp.lang.c:11607
  897.  
  898. Submitted-by: Landon Curt Noll <chongo@uts.amdahl.com>
  899. Posting-number: Volume 15, Issue 109
  900. Archive-name: ioccc/part05
  901.  
  902. # This is a shell archive.  Remove anything before this line, then
  903. # unpack it by saving it in a file and typing "sh file".  (Files
  904. # unpacked will be owned by you and have default permissions.)
  905. #
  906. # This archive contains:
  907. # ./1986/Makefile ./1986/README ./1986/applin.c ./1986/applin.hint
  908. # ./1986/august.c ./1986/august.hint ./1986/bright.c ./1986/bright.hint
  909. # ./1986/hague.c ./1986/hague.hint ./1986/holloway.c ./1986/holloway.hint
  910. # ./1986/marshall.c ./1986/marshall.hint ./1986/pawka.c ./1986/pawka.hint
  911. # ./1986/rules ./1986/stein.c ./1986/stein.hint ./1986/wall.c
  912. # ./1986/wall.hint
  913.  
  914. echo x - ./1986/Makefile
  915. sed -e 's/^X//' > "./1986/Makefile" << '//E*O*F ./1986/Makefile//'
  916. X# %W% %G% %U%
  917. X#
  918. X# 1986 makefile
  919. X
  920. XSHELL=/bin/sh
  921. XWINNERS=marshall hague applin bright stein holloway august pawka wall
  922. X
  923. Xall: ${WINNERS}
  924. X
  925. Xmarshall: marshall.c
  926. X    cc $? -o $@
  927. Xhague: hague.c
  928. X    cc $? -o $@
  929. Xapplin: applin.c
  930. X    cc $? -o $@
  931. Xbright: bright.c
  932. X    cc $? -o $@
  933. Xstein: stein.c
  934. X    -rm -f a.out
  935. X    cc $? -o $@
  936. X    -ln $@ a.out
  937. Xholloway: holloway.c
  938. X    cc $? -o $@
  939. Xaugust: august.c
  940. X    cc $? -o $@
  941. Xpawka: pawka.c
  942. X    cc $? -o $@
  943. Xwall: wall.c
  944. X    cc $? -o $@
  945. X
  946. Xclean:
  947. X    rm -f core
  948. Xclobber: clean
  949. X    rm -f ${WINNERS} a.out
  950. Xinstall: all
  951. X    @echo are you kidding'??'
  952. //E*O*F ./1986/Makefile//
  953.  
  954. echo x - ./1986/README
  955. sed -e 's/^X//' > "./1986/README" << '//E*O*F ./1986/README//'
  956. XThe 1986 contest was named: "The Third International Obfuscated C Code Contest"
  957. X
  958. XThe rules for 1986 suggested categories due to the success of the 1985
  959. Xjudging method.  The maximum size was increased from 512 to 1024 bytes.
  960. XLarry Bassel joined as the second official judge.
  961. X
  962. XA poll was taken for the worst code for BSD and System V program.
  963. XThe Bourne Shell (/bin/sh) won for both systems.  The BSD finger 
  964. Xprogram took third place.
  965. X
  966. XRules and results were posted to net.lang.c and net.unix-wizards.
  967. XMicro/Systems Journal published started regular publishing of the winners.
  968. XThe practice of making first announcement of the winners at the Summer
  969. XUsenix BOF started this year.  A notice was posted to net.announce.
  970. X
  971. //E*O*F ./1986/README//
  972.  
  973. echo x - ./1986/applin.c
  974. sed -e 's/^X//' > "./1986/applin.c" << '//E*O*F ./1986/applin.c//'
  975. Xcat =13 /*/ >/dev/null 2>&1; echo "Hello, world!"; exit
  976. X*
  977. X*  This program works under cc, f77, and /bin/sh.
  978. X*
  979. X*/; main() {
  980. X      write(
  981. Xcat-~-cat
  982. X     /*,'(
  983. X*/
  984. X     ,"Hello, world!"
  985. X     ,
  986. Xcat); putchar(~-~-~-cat); } /*
  987. X     ,)')
  988. X      end
  989. X*/
  990. //E*O*F ./1986/applin.c//
  991.  
  992. echo x - ./1986/applin.hint
  993. sed -e 's/^X//' > "./1986/applin.hint" << '//E*O*F ./1986/applin.hint//'
  994. XMost adaptable program: <hpfcdc!jack> Jack Applin
  995. X
  996. X    Jack Applin
  997. X    Hewlett-Packard
  998. X    Ft. Collins
  999. X    Colorado
  1000. X    USA
  1001. X
  1002. XCompile and/or execute as directed by the documentation.
  1003. X
  1004. XThe judges were so amused by this little program that we created an
  1005. Xaward just for it.  This program is portable to the C and Fortran 77
  1006. Xcompilers as well as executable by the bourne shell!
  1007. //E*O*F ./1986/applin.hint//
  1008.  
  1009. echo x - ./1986/august.c
  1010. sed -e 's/^X//' > "./1986/august.c" << '//E*O*F ./1986/august.c//'
  1011. Xtypedef struct n{int a:3,
  1012. Xb:29;struct n*c;}t;t*
  1013. Xf();r(){}m(u)t*u;{t*w,*z;
  1014. Xz=u->c,q(z),u->b=z->b*10,
  1015. Xw=u->c=f(),w->a=1,w->c=z->
  1016. Xc;}t*k;g(u)t*u;{t*z,*v,*p,
  1017. X*x;z=u->c,q(z),u->b=z->b,v
  1018. X=z->c,z->a=2,x=z->c=f(),x
  1019. X->a=3,x->b=2,p=x->c=f(),p
  1020. X->c=f(),p->c->a=1,p->c->c=
  1021. Xv;}int i;h(u)t*u;{t*z,*v,*
  1022. Xw;int c,e;z=u->c,v=z->c,q(
  1023. Xv),c=u->b,e=v->b,u->b=z->b
  1024. X,z->a=3,z->b=c+1,e+9>=c&&(
  1025. Xq(z),e=z->b,u->b+=e/c,w=f(
  1026. X),w->b=e%c,w->c=z->c,u->c=
  1027. Xw);}int(*y[4])()={r,m,g,h};
  1028. Xchar *sbrk();main(){t*e,*p,*o;
  1029. Xo=f(),o->c=o,o->b=1,e=f(),
  1030. Xe->a=2,p=e->c=f(),p->b=2,
  1031. Xp->c=o,q(e),e=e->c,(void)write
  1032. X(1,"2.",2);for(;;e=e->c){q(e),
  1033. Xe->b=write(1,&e->b["0123456789"],
  1034. X1);}}t*f(){return i||(i=1000,
  1035. Xk=(t*)sbrk(i*sizeof(t))),k+--i;
  1036. X}q(p)t*p;{(*y[p->a])(p);}
  1037. //E*O*F ./1986/august.c//
  1038.  
  1039. echo x - ./1986/august.hint
  1040. sed -e 's/^X//' > "./1986/august.hint" << '//E*O*F ./1986/august.hint//'
  1041. XBest complex task done in a complex way: <augustss@chalmers> Lennart Augustsson
  1042. X
  1043. X    Lennart Augustsson
  1044. X    Dept. of Comp. Sci.
  1045. X    Chalmers University of Technology,
  1046. X    412 96 Gothenburg
  1047. X    Sweden
  1048. X
  1049. XThis program computes a specific mathematical value.  Simply compile
  1050. Xand give it an infinite amount of stack space and cpu time.  Otherwise
  1051. Xjust be satisfied with the approximation displayed just before the core
  1052. Xdump.
  1053. X
  1054. XThis program will pass lint on your system assuming your lint is brave
  1055. Xenough to try and parse it correctly.
  1056. //E*O*F ./1986/august.hint//
  1057.  
  1058. echo x - ./1986/bright.c
  1059. sed -e 's/^X//' > "./1986/bright.c" << '//E*O*F ./1986/bright.c//'
  1060. X#include <stdio.h>
  1061. X#define O1O printf
  1062. X#define OlO putchar
  1063. X#define O10 exit
  1064. X#define Ol0 strlen
  1065. X#define QLQ fopen
  1066. X#define OlQ fgetc
  1067. X#define O1Q abs
  1068. X#define QO0 for
  1069. Xtypedef char lOL;
  1070. X
  1071. XlOL*QI[] = {"Use:\012\011dump file\012","Unable to open file '\x25s'\012",
  1072. X "\012","   ",""};
  1073. X
  1074. Xmain(I,Il)
  1075. XlOL*Il[];
  1076. X{    FILE *L;
  1077. X    unsigned lO;
  1078. X    int Q,OL[' '^'0'],llO = EOF,
  1079. X
  1080. X    O=1,l=0,lll=O+O+O+l,OQ=056;
  1081. X    lOL*llL="%2x ";
  1082. X    (I != 1<<1&&(O1O(QI[0]),O10(1011-1010))),
  1083. X    ((L = QLQ(Il[O],"r"))==0&&(O1O(QI[O],Il[O]),O10(O)));
  1084. X    lO = I-(O<<l<<O);
  1085. X    while (L-l,1)
  1086. X    {    QO0(Q = 0L;((Q &~(0x10-O))== l);
  1087. X            OL[Q++] = OlQ(L));
  1088. X        if (OL[0]==llO) break;
  1089. X        O1O("\0454x: ",lO);
  1090. X        if (I == (1<<1))
  1091. X        {    QO0(Q=Ol0(QI[O<<O<<1]);Q<Ol0(QI[0]);
  1092. X            Q++)O1O((OL[Q]!=llO)?llL:QI[lll],OL[Q]);/*"
  1093. X            O10(QI[1O])*/
  1094. X            O1O(QI[lll]);{}
  1095. X        }
  1096. X        QO0 (Q=0L;Q<1<<1<<1<<1<<1;Q+=Q<0100)
  1097. X        {    (OL[Q]!=llO)? /* 0010 10lOQ 000LQL */
  1098. X            ((D(OL[Q])==0&&(*(OL+O1Q(Q-l))=OQ)),
  1099. X            OlO(OL[Q])):
  1100. X            OlO(1<<(1<<1<<1)<<1);
  1101. X        }
  1102. X        O1O(QI[01^10^9]);
  1103. X        lO+=Q+0+l;}
  1104. X    }
  1105. X    D(l) { return l>=' '&&l<='\~';
  1106. X}
  1107. //E*O*F ./1986/bright.c//
  1108.  
  1109. echo x - ./1986/bright.hint
  1110. sed -e 's/^X//' > "./1986/bright.hint" << '//E*O*F ./1986/bright.hint//'
  1111. XMost useful obfuscation: <dataio!bright> Walter Bright
  1112. X
  1113. XCompile this program and give filenames as arguments.  For example try:
  1114. X
  1115. X    bright bright.c
  1116. X    bright bright
  1117. X
  1118. XMr. Bright exploits the c pre-processor, similar variables and
  1119. Xexcessive shifting to obfuscate an otherwise useful binary display
  1120. Xprogram.  This gives you a small example of what it is like to
  1121. Xmaintain the Bourne shell! :-}
  1122. //E*O*F ./1986/bright.hint//
  1123.  
  1124. echo x - ./1986/hague.c
  1125. sed -e 's/^X//' > "./1986/hague.c" << '//E*O*F ./1986/hague.c//'
  1126. X#define    DIT    (
  1127. X#define    DAH    )
  1128. X#define    __DAH    ++
  1129. X#define DITDAH    *
  1130. X#define    DAHDIT    for
  1131. X#define    DIT_DAH    malloc
  1132. X#define DAH_DIT    gets
  1133. X#define    _DAHDIT    char
  1134. X_DAHDIT _DAH_[]="ETIANMSURWDKGOHVFaLaPJBXCYZQb54a3d2f16g7c8a90l?e'b.s;i,d:"
  1135. X;main            DIT            DAH{_DAHDIT
  1136. XDITDAH            _DIT,DITDAH        DAH_,DITDAH DIT_,
  1137. XDITDAH            _DIT_,DITDAH        DIT_DAH DIT
  1138. XDAH,DITDAH        DAH_DIT DIT        DAH;DAHDIT
  1139. XDIT _DIT=DIT_DAH    DIT 81            DAH,DIT_=_DIT
  1140. X__DAH;_DIT==DAH_DIT    DIT _DIT        DAH;__DIT
  1141. XDIT'\n'DAH DAH        DAHDIT DIT        DAH_=_DIT;DITDAH
  1142. XDAH_;__DIT        DIT            DITDAH
  1143. X_DIT_?_DAH DIT        DITDAH            DIT_ DAH:'?'DAH,__DIT
  1144. XDIT' 'DAH,DAH_ __DAH    DAH DAHDIT        DIT
  1145. XDITDAH            DIT_=2,_DIT_=_DAH_;    DITDAH _DIT_&&DIT
  1146. XDITDAH _DIT_!=DIT    DITDAH DAH_>='a'?    DITDAH
  1147. XDAH_&223:DITDAH        DAH_ DAH DAH;        DIT
  1148. XDITDAH            DIT_ DAH __DAH,_DIT_    __DAH DAH
  1149. XDITDAH DIT_+=        DIT DITDAH _DIT_>='a'?    DITDAH _DIT_-'a':0
  1150. XDAH;}_DAH DIT DIT_    DAH{            __DIT DIT
  1151. XDIT_>3?_DAH        DIT             DIT_>>1 DAH:'\0'DAH;return
  1152. XDIT_&1?'-':'.';}__DIT DIT            DIT_ DAH _DAHDIT
  1153. XDIT_;{DIT void DAH write DIT            1,&DIT_,1 DAH;}
  1154. //E*O*F ./1986/hague.c//
  1155.  
  1156. echo x - ./1986/hague.hint
  1157. sed -e 's/^X//' > "./1986/hague.hint" << '//E*O*F ./1986/hague.hint//'
  1158. XWorst abuse of the C preprocessor: <ukc!jmh> Jim Hague
  1159. X
  1160. X    Jim Hague
  1161. X    University of Kent at Canterbury
  1162. X    Canterbury, Kent
  1163. X    UK
  1164. X
  1165. XCompile this program and feed ascii text into standard input.  This
  1166. Xprogram is known to pass lint on some systems and abort lint on
  1167. Xothers.
  1168. X
  1169. XThis program was selected for the 1987 t-shirt collection.
  1170. X
  1171. XThink morse code when you ponder this program.  Note how use of
  1172. Xsimilar variables can be obfuscating!  The author notes that this
  1173. Xprogram implements the international morse standard.  Now for extra
  1174. Xcredit, what morse message does the program spell out?
  1175. //E*O*F ./1986/hague.hint//
  1176.  
  1177. echo x - ./1986/holloway.c
  1178. sed -e 's/^X//' > "./1986/holloway.c" << '//E*O*F ./1986/holloway.c//'
  1179. X#include "stdio.h"
  1180. X#define    e 3
  1181. X#define    g (e/e)
  1182. X#define    h ((g+e)/2)
  1183. X#define    f (e-g-h)
  1184. X#define    j (e*e-g)
  1185. X#define k (j-h)
  1186. X#define    l(x) tab2[x]/h
  1187. X#define    m(n,a) ((n&(a))==(a))
  1188. X
  1189. Xlong tab1[]={ 989L,5L,26L,0L,88319L,123L,0L,9367L };
  1190. Xint tab2[]={ 4,6,10,14,22,26,34,38,46,58,62,74,82,86 };
  1191. X
  1192. Xmain(m1,s) char *s; {
  1193. X    int a,b,c,d,o[k],n=(int)s;
  1194. X    if(m1==1){ char b[2*j+f-g]; main(l(h+e)+h+e,b); printf(b); }
  1195. X    else switch(m1-=h){
  1196. X    case f:
  1197. X        a=(b=(c=(d=g)<<g)<<g)<<g;
  1198. X        return(m(n,a|c)|m(n,b)|m(n,a|d)|m(n,c|d));
  1199. X    case h:
  1200. X        for(a=f;a<j;++a)if(tab1[a]&&!(tab1[a]%((long)l(n))))return(a);
  1201. X    case g:
  1202. X        if(n<h)return(g);
  1203. X        if(n<j){n-=g;c='D';o[f]=h;o[g]=f;}
  1204. X        else{c='\r'-'\b';n-=j-g;o[f]=o[g]=g;}
  1205. X        if((b=n)>=e)for(b=g<<g;b<n;++b)o[b]=o[b-h]+o[b-g]+c;
  1206. X        return(o[b-g]%n+k-h);
  1207. X    default:
  1208. X        if(m1-=e) main(m1-g+e+h,s+g); else *(s+g)=f;
  1209. X        for(*s=a=f;a<e;) *s=(*s<<e)|main(h+a++,(char *)m1);
  1210. X    }
  1211. X}
  1212. //E*O*F ./1986/holloway.c//
  1213.  
  1214. echo x - ./1986/holloway.hint
  1215. sed -e 's/^X//' > "./1986/holloway.hint" << '//E*O*F ./1986/holloway.hint//'
  1216. XBest simple task performed in a complex way: <drivax!holloway> Bruce Holloway
  1217. X
  1218. X    Bruce Holloway
  1219. X    Digital Research, Inc.
  1220. X    Monterey, CA
  1221. X    USA
  1222. X
  1223. XBelieve it or not, this is the old standard "Hello, world" program
  1224. Xperformed in a very complex way.  The judges and the author defy you
  1225. Xdo determine how it does it.  It is a good thing that K&R didn't use
  1226. Xthis version as the first C program!
  1227. //E*O*F ./1986/holloway.hint//
  1228.  
  1229. echo x - ./1986/marshall.c
  1230. sed -e 's/^X//' > "./1986/marshall.c" << '//E*O*F ./1986/marshall.c//'
  1231. X                                                   extern int
  1232. X                                                       errno
  1233. X                                                         ;char
  1234. X                                                            grrr
  1235. X                             ;main(                           r,
  1236. X  argv, argc )            int    argc                           ,
  1237. X   r        ;           char *argv[];{int                     P( );
  1238. X#define x  int i,       j,cc[4];printf("      choo choo\n"     ) ;
  1239. Xx  ;if    (P(  !        i              )        |  cc[  !      j ]
  1240. X&  P(j    )>2  ?        j              :        i  ){*  argv[i++ +!-i]
  1241. X;              for    (i=              0;;    i++                   );
  1242. X_exit(argv[argc- 2    / cc[1*argc]|-1<<4 ]    ) ;printf("%d",P(""));}}
  1243. X  P  (    a  )   char a   ;  {    a  ;   while(    a  >      "  B   "
  1244. X  /* -    by E            ricM    arsh             all-      */);    }
  1245. //E*O*F ./1986/marshall.c//
  1246.  
  1247. echo x - ./1986/marshall.hint
  1248. sed -e 's/^X//' > "./1986/marshall.hint" << '//E*O*F ./1986/marshall.hint//'
  1249. XBest layout: <burdvax!eric> Eric Marshall
  1250. X
  1251. X    Eric Marshall
  1252. X    System Development Corporation, a Burroughs Company
  1253. X    P.O. Box 517
  1254. X    Paoli, PA.
  1255. X    19301
  1256. X
  1257. XThis program prints the name of the picture.  The layout is somewhat
  1258. Xpretty through it is not the usual sort of output one would expect
  1259. Xfrom printing a program!
  1260. X
  1261. XThis program was slected for the 1987 t-shirt collection.
  1262. X
  1263. XThis program is known to give some C compilers a problems.
  1264. //E*O*F ./1986/marshall.hint//
  1265.  
  1266. echo x - ./1986/pawka.c
  1267. sed -e 's/^X//' > "./1986/pawka.c" << '//E*O*F ./1986/pawka.c//'
  1268. X#include "stdio.h"
  1269. X#define xyxx char
  1270. X#define xyyxx putchar
  1271. X#define xyyyxx while
  1272. X#define xxyyyx int
  1273. X#define xxxyyx main
  1274. X#define xyxyxy if
  1275. X#define xyyxyy '\n'
  1276. Xxyxx *xyx [] = {
  1277. X"]I^x[I]k\\I^o[IZ~\\IZ~[I^|[I^l[I^j[I^}[I^n[I]m\\I]h",
  1278. X"]IZx\\IZx[IZk\\IZk[IZo_IZ~\\IZ~[IZ|_IZl_IZj\\IZj]IZ}]IZn_IZm\\IZm_IZh",
  1279. X"]IZx\\IZx[I^k[I\\o]IZ~\\IZ~\\I]|[IZl_I^j]IZ}]I^n[IZm\\IZm_IZh",
  1280. X"]IZx\\IZx[IZk\\IZk[IZo_IZ~\\IZ~_IZ|[IZl_IZj\\IZj]IZ}]IZn_IZm\\IZm]IZh",
  1281. X"]I^x[I]k\\IZo_I^~[I^|[I^l[IZj\\IZj]IZ}]I^n[I]m^IZh",'\0'};/*xyyxyxyxxxyxxxyy*/
  1282. Xxyxx *xyyx; xxyyyx xyyyx,xyyyyx,xyyyyyx=0x59,xyyyyyyx=0x29,/*yxxyxyyyxxyyyxyy*/
  1283. Xxxyx=0x68;xxxyyx(){xyyyyx=0;xyyyxx(xyx[xyyyyx]){xyyx=xyx[xyyyyx++];/*xyyyxxyx*/
  1284. Xxyyyxx(*xyyx){xyyyx= *xyyx++-xyyyyyx;xyyyxx(xyyyx--)xyyxx(*xyyx-xyyyyyyx);/*x*/
  1285. Xxyxyxy(*xyyx==xxyx)xyyxx(xyyxyy);*xyyx++;}}}/*xyxyxyyyyxxyxxxyyyxyyyxyxxyyy*/
  1286. //E*O*F ./1986/pawka.c//
  1287.  
  1288. echo x - ./1986/pawka.hint
  1289. sed -e 's/^X//' > "./1986/pawka.hint" << '//E*O*F ./1986/pawka.hint//'
  1290. XMost illegible code: <PAWKA@NOSC-TECR.ARPA> Michael H. Pawka
  1291. X
  1292. X     Michael H. Pawka
  1293. X    Naval Ocean Systems Center
  1294. X    San Diego, Ca
  1295. X    92152
  1296. X
  1297. XThe judges found this entry to be one of hardest to read without the
  1298. Xaid of /lib/cpp and a good editor.  When run, the program asks if it
  1299. Xis obfuscated, of all things!
  1300. //E*O*F ./1986/pawka.hint//
  1301.  
  1302. echo x - ./1986/rules
  1303. sed -e 's/^X//' > "./1986/rules" << '//E*O*F ./1986/rules//'
  1304. XWARNING: The rules and mailing address for the contest change from year
  1305. X         to year.  Be sure that you consult the current set of rules
  1306. X     before submitting entries.
  1307. X-------------------------------------------------------------------------------
  1308. X
  1309. XSubject: Third International Obfuscated C Code Contest Rules
  1310. XNewsgroups: net.lang.c
  1311. XKeywords: rules,1986,obfuscate,contest
  1312. X
  1313. XGOAL:  To write the most Obscure working C program following the rules below:
  1314. X
  1315. XRULES:    1) The source must be 1024 bytes or less.  NO exceptions!
  1316. X
  1317. X    2) Include in your letter:
  1318. X        a) Name (or anonymous), Company/School, City, State and Country.
  1319. X        b) Your path from a major network site, if applicable.
  1320. X        c) A brief statement of what the program should do.
  1321. X        d) The Machine(s)/Operating system(s) on which it runs.
  1322. X        e) Enclose your source between the following lines:
  1323. X        ---start of program---
  1324. X        <place obfuscated source of 1024 bytes or less here>
  1325. X        ---end of program---
  1326. X
  1327. X    3) The entry should be written in common C. (K&R + common extensions)
  1328. X
  1329. X    4) The program must be of original work.  All programs must be
  1330. X       in the public domain.  All copyrighted programs will be rejected.
  1331. X
  1332. X    5) Entries must be received between 31-Mar-86 and 30-May-86 0:00 GMT.
  1333. X       Email your entries to:
  1334. X       
  1335. X                decwrl!nsc!obfuscate
  1336. X
  1337. X       Entries sent by UUCP Email will be confirmed starting 1-May-86.
  1338. X       People are encouraged to submit entries via Email, however one may
  1339. X       mail entries the following address:
  1340. X
  1341. X        International Obfuscated C Code Contest
  1342. X        National Semiconductor
  1343. X        Attn: Landon Noll      Mail Stop: 7c266
  1344. X        1135 Kern Ave.
  1345. X        Sunnyvale, CA 94086
  1346. X        U.S.A.
  1347. X
  1348. XAWARDS:    Winners of each category and the best of Show will be posted to
  1349. X    net.announce as well as being published in the May 86 issue of the
  1350. X    "Micro/Systems Journal".  Winners also get to receive international
  1351. X    fame/flame for their efforts!
  1352. X
  1353. XJUDGING: Awards will be given to the best entry in a number of categories.
  1354. X     The actual category list will vary depending on the types of entries
  1355. X     we receive.  At the moment, we are considering using the following:
  1356. X
  1357. X        * The most obscure algorithm
  1358. X        * The worst abuse of the C preprocessor
  1359. X        * The strangest source layout
  1360. X        * The best small one line program
  1361. X        * The most useful program
  1362. X        * <anything else we need to give recognition to a good entry>
  1363. X
  1364. X    Judging will be done by myself, Larry Bassel and other local people
  1365. X    who are willing to help out.
  1366. X
  1367. X    We will attempt to run each of them on a Vax 785/4.2BSD system.
  1368. X    Don't let the lack of such a system stop you!  Try to avoid operating
  1369. X    system/machine specific code if you do not have such a system.
  1370. X    Extra points will be given for programs which:
  1371. X
  1372. X        a) pass lint without complaint
  1373. X        b) do something quasi-interesting
  1374. X        c) are portable
  1375. X
  1376. X    A larger program size was selected to allow for a wider range of
  1377. X    program ideas.  However if you don't need 1024 bytes don't use them.
  1378. X    Given two programs with similar techniques and similar levels of
  1379. X    obfuscation, we will tend to favor the more concise entry.
  1380. X
  1381. XPOLL:    We want to know what you think is the most poorly coded utility
  1382. X    released with 4.xBSD and/or Sys V.  The top results plus the
  1383. X    best flames will be posted along with the contest results.
  1384. X    To vote, please    follow the guidelines below:
  1385. X
  1386. X    1) Include at the top of the letter:
  1387. X        a) Name (or anonymous), Company/School, City, State and Country.
  1388. X        b) Your path from a major network site, if applicable.
  1389. X        c) the name of the poorly coded utility
  1390. X        d) the name of the operating system on which it is found
  1391. X        e) the line:    <<<FLAME ON>>>
  1392. X        f)         up to 1024 bytes of flames
  1393. X        g) the line:    <<<FLAME OFF>>>
  1394. X
  1395. X    2) Confine your vote to the standard set of commands.  I.e., don't
  1396. X       flame about local commands or user contributed software.
  1397. X
  1398. X    3) Submit your votes via Email to:
  1399. X
  1400. X           for 4.xBSD:  decwrl!nsc!bsd_util
  1401. X           for Sys V:   decwrl!nsc!sysV_util
  1402. X
  1403. X       or, you may send your votes by letter to the same address used by
  1404. X       the contest.  Please place your votes on different sheets of paper.
  1405. X
  1406. Xchongo <C> /\cc/\
  1407. //E*O*F ./1986/rules//
  1408.  
  1409. echo x - ./1986/stein.c
  1410. sed -e 's/^X//' > "./1986/stein.c" << '//E*O*F ./1986/stein.c//'
  1411. Xtypedef char*z;O;o;_=33303285;main(b,Z)z Z;{b=(b>=0||(main(b+1,Z+1),*Z=O%(o=(_%
  1412. X25))+'0',O/=o,_/=25))&&(b<1||(O=time(&b)%0250600,main(~5,*(z*)Z),write(1,*(z*)Z
  1413. X,9)));}
  1414. //E*O*F ./1986/stein.c//
  1415.  
  1416. echo x - ./1986/stein.hint
  1417. sed -e 's/^X//' > "./1986/stein.hint" << '//E*O*F ./1986/stein.hint//'
  1418. XBest one liner: <gustaf!cd-jan> Jan Stein
  1419. X
  1420. XNOTE: to avoid problems with news and mail, the single line was split
  1421. X      into 3 lines.  Join all lines into a single line to recreate
  1422. X      the original file.
  1423. X
  1424. XCompile and link to a filename called 'a.out'.  Try the program with the
  1425. Xfollowing argument:
  1426. X
  1427. X    a.out ^N^N
  1428. X
  1429. X(^N is ASCII control-N).  One some machines, ^M^L is needed to get it to
  1430. Xoutput cleanly.  Your system may require another set of characters.
  1431. XIn time, you will figure out what it does. :-)
  1432. //E*O*F ./1986/stein.hint//
  1433.  
  1434. echo x - ./1986/wall.c
  1435. sed -e 's/^X//' > "./1986/wall.c" << '//E*O*F ./1986/wall.c//'
  1436. X#define _c(C)_ (C)&('|'+3):c_()(C)>>('\n'-3) __; /**/
  1437. X#define C char*
  1438. X#define keyboard ",,B3-u;.(&*5., /(b*(1\036!a%\031m,,,,,\r\n"
  1439. X#define main(o,oo)oo(o){
  1440. X#define _ ;case
  1441. XC
  1442. X#define c_(cc)c cc=
  1443. X#define C_(sand)_O(sand)witch
  1444. Xo=keyboard;
  1445. X#define __ ;break;
  1446. XC
  1447. Xccc(
  1448. Xcc)
  1449. XC
  1450. Xcc;
  1451. X{
  1452. XC
  1453. Xcccc=
  1454. Xcc;int
  1455. X#ifndef lint
  1456. X#define keyboard "dijs QH.soav Vdtnsaoh DmfpaksoQz;kkt oa, -dijs"
  1457. X#endif
  1458. Xc;
  1459. Xmain(;c_(=(*cc);*cc++)c,for);
  1460. X#define _O(s)s
  1461. Xmain(0xb+(c>>5),C_(s))
  1462. X_'\v'
  1463. X:__ _'\f':
  1464. Xmain(c,C_(s));
  1465. X_c(8098)_c(6055)_c(14779)_c(10682)
  1466. X#define O_(O)_O(O)stem(ccc(
  1467. X_c(15276)_c(11196)_c(15150)
  1468. X#define _C ;return
  1469. X_c(11070)_c(15663)_c(11583)
  1470. X}
  1471. X__
  1472. Xdefault
  1473. X:c_(+)o[c&__LINE__-007];
  1474. Xmain(c_(-)'-'-1,C_(s))_
  1475. X0214
  1476. X:_
  1477. X0216
  1478. X:c_(+)025 _
  1479. X0207
  1480. X:c_(-)4 _
  1481. X0233
  1482. X:c_(+)' '-1;
  1483. X}}c_(&)'z'+5;
  1484. X}_C cccc;
  1485. X}main(,cc)
  1486. XC
  1487. X#define O write(1,
  1488. Xc="O";
  1489. XO_(sy) keyboard));
  1490. Xmain(;;,for);
  1491. Xread(0,
  1492. Xc,1);*
  1493. Xc_(&)'~'+1
  1494. X;O ccc(
  1495. Xc),
  1496. X'\0');
  1497. Xmain(*c,
  1498. XC_(s));_
  1499. X4
  1500. X:O_(sy)";kkt -oa, dijszdijs QQ"))_C
  1501. X_
  1502. X13
  1503. X:O o+' ',
  1504. X3
  1505. X)
  1506. X#undef main
  1507. X__ _ 127:O"\b \b",3)__
  1508. Xdefault
  1509. X:O
  1510. Xc,1)
  1511. X__}}}main(){
  1512. Xcc();
  1513. X}
  1514. //E*O*F ./1986/wall.c//
  1515.  
  1516. echo x - ./1986/wall.hint
  1517. sed -e 's/^X//' > "./1986/wall.hint" << '//E*O*F ./1986/wall.hint//'
  1518. XThe grand prize in most well-rounded in confusion: <sdcrdcf!lwall> Larry Wall
  1519. X
  1520. X     Larry Wall
  1521. X    System Development Corporation
  1522. X    Santa Monica
  1523. X    California
  1524. X    US of A
  1525. X
  1526. XThe original version did not have a `;' character in the first line.
  1527. XThis caused a number of System V C pre-preprocessors to gripe about a
  1528. Xsyntax error.
  1529. X
  1530. XThis program is a masterpiece of obfuscation and humor.  Larry Wall
  1531. X(the hacker who gave us rn and patch) asks you to compile and consider
  1532. Xthe warning message generated by the C compiler.  Then execute the
  1533. Xprogram and type charters into its standard input.  You will see why
  1534. Xthe compiler documents the program.
  1535. //E*O*F ./1986/wall.hint//
  1536.  
  1537. echo Possible errors detected by \'wc\' [hopefully none]:
  1538. temp=/tmp/shar$$
  1539. trap "rm -f $temp; exit" 0 1 2 3 15
  1540. cat > $temp <<\!!!
  1541.  36  96  530  Makefile
  1542.  15  115  715  README
  1543.  15  37  243  applin.c
  1544.  13  57  358  applin.hint
  1545.  26  34  718  august.c
  1546.  15  79  514  august.hint
  1547.  47  111  1020  bright.c
  1548.  11  57  386  bright.hint
  1549.  28  118  991  hague.c
  1550.  17  93  578  hague.hint
  1551.  33  72  912  holloway.c
  1552.  11  66  381  holloway.hint
  1553.  14  87  938  marshall.c
  1554.  15  68  425  marshall.hint
  1555.  18  41  838  pawka.c
  1556.  10  51  300  pawka.hint
  1557.  103  634  4048  rules
  1558.  3  5  168  stein.c
  1559.  14  85  501  stein.hint
  1560.  78  125  1025  wall.c
  1561.  17  103  625  wall.hint
  1562.  539  2134  16214  total
  1563. !!!
  1564. wc  ./1986/Makefile ./1986/README ./1986/applin.c ./1986/applin.hint ./1986/august.c ./1986/august.hint ./1986/bright.c ./1986/bright.hint ./1986/hague.c ./1986/hague.hint ./1986/holloway.c ./1986/holloway.hint ./1986/marshall.c ./1986/marshall.hint ./1986/pawka.c ./1986/pawka.hint ./1986/rules ./1986/stein.c ./1986/stein.hint ./1986/wall.c ./1986/wall.hint | sed 's=[^ ]*/==' | diff -b $temp -
  1565. exit 0
  1566.  
  1567. -- 
  1568. Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
  1569. Path: killer!osu-cis!tut.cis.ohio-state.edu!rutgers!gatech!bbn!bbn.com!rsalz
  1570. From: rsalz@uunet.uu.net (Rich Salz)
  1571. Newsgroups: comp.sources.unix,comp.lang.c
  1572. Subject: v15i110:  International Obfuscated C Code Contest, Part06/07
  1573. Message-ID: <1013@fig.bbn.com>
  1574. Date: 2 Aug 88 20:40:50 GMT
  1575. Lines: 654
  1576. Approved: rsalz@uunet.UU.NET
  1577. Xref: killer comp.sources.unix:639 comp.lang.c:11608
  1578.  
  1579. Submitted-by: Landon Curt Noll <chongo@uts.amdahl.com>
  1580. Posting-number: Volume 15, Issue 110
  1581. Archive-name: ioccc/part06
  1582.  
  1583. # This is a shell archive.  Remove anything before this line, then
  1584. # unpack it by saving it in a file and typing "sh file".  (Files
  1585. # unpacked will be owned by you and have default permissions.)
  1586. #
  1587. # This archive contains:
  1588. # ./1987/Makefile ./1987/README ./1987/biggar.c ./1987/biggar.hint
  1589. # ./1987/heckbert.c ./1987/heckbert.hint ./1987/hines.c ./1987/hines.hint
  1590. # ./1987/korn.c ./1987/korn.hint ./1987/lievaart.c ./1987/lievaart.hint
  1591. # ./1987/lievaart2.c ./1987/rules ./1987/wall.c ./1987/wall.hint
  1592. # ./1987/westley.c ./1987/westley.hint
  1593.  
  1594. echo x - ./1987/Makefile
  1595. sed -e 's/^X//' > "./1987/Makefile" << '//E*O*F ./1987/Makefile//'
  1596. X# %W% %G% %U%
  1597. X#
  1598. X# 1987 makefile
  1599. X
  1600. XSHELL=/bin/sh
  1601. XWINNERS=heckbert wall westley hines korn biggar lievaart lievaart2
  1602. X
  1603. X# for System V style systems
  1604. XOPSYS=-Dindex=strchr
  1605. X# for BSD style systems
  1606. X#OPSYS=
  1607. X
  1608. Xall: ${WINNERS}
  1609. X
  1610. Xheckbert: heckbert.c
  1611. X    cc ${OPSYS} $? -o $@
  1612. Xwall: wall.c
  1613. X    cc $? -o $@
  1614. Xwestley: westley.c
  1615. X    cc $? -o $@
  1616. Xhines: hines.c
  1617. X    cc $? -o $@
  1618. Xkorn: korn.c
  1619. X    cc $? -o $@
  1620. Xbiggar: biggar.c
  1621. X    cc -DC="R>0" -DI="if(T)O" -DO="c=write(1,&c,1);" \
  1622. X        -DP="main(){X}" -DR="read(0,&c,1)" -DT="c!=015" \
  1623. X        -DW="while(C)I" -DX="char c;W" $? -o $@
  1624. Xlievaart: lievaart.c
  1625. X    cc $? -o $@
  1626. X# not an official entry
  1627. Xlievaart2: lievaart2.c
  1628. X    cc $? -o $@
  1629. X
  1630. Xclean:
  1631. X    rm -f core
  1632. Xclobber: clean
  1633. X    rm -f ${WINNERS}
  1634. Xinstall: all
  1635. X    @echo are you kidding'??'
  1636. //E*O*F ./1987/Makefile//
  1637.  
  1638. echo x - ./1987/README
  1639. sed -e 's/^X//' > "./1987/README" << '//E*O*F ./1987/README//'
  1640. X1987 marked the "The Fourth International Obfuscated C Code Contest"
  1641. X
  1642. XThe rules for 1987 suggested even more categories than in 1986.  Hints
  1643. Xfor what to do and not to do were also given in the rules.  For
  1644. Xexample, a simple excessive abuse of /lib/cpp was discouraged unless
  1645. Xthe abuse was unusual.  The mailboxes for the contest were moved from
  1646. Xnsc to amdahl.  The practice of posting a preliminary set of rules for
  1647. Xthe next year was started this year.
  1648. X
  1649. XRules and results were posted to comp.lang.c, comp.unix.wizards with
  1650. Xan announcement in news.announce.important.  Micro/Systems Journal
  1651. Xpublished the 1987 winners.  Mark Horton included a version of the 1987
  1652. Xwinners in an appendix of his C book.  The first announcement of
  1653. Xwinners at the Summer 87 Usenix was helped by a small fly that
  1654. Xdanced all over the foils.
  1655. //E*O*F ./1987/README//
  1656.  
  1657. echo x - ./1987/biggar.c
  1658. sed -e 's/^X//' > "./1987/biggar.c" << '//E*O*F ./1987/biggar.c//'
  1659. XP;
  1660. //E*O*F ./1987/biggar.c//
  1661.  
  1662. echo x - ./1987/biggar.hint
  1663. sed -e 's/^X//' > "./1987/biggar.hint" << '//E*O*F ./1987/biggar.hint//'
  1664. XBest Abuse of the Rules: <sdcrdcf!markb> Mark Biggar
  1665. X
  1666. X    Mark Biggar
  1667. X    UNiSYS - System Development Group, Santa Monica
  1668. X    2525 Colorado AV MD 91-01
  1669. X    Santa Monica, CA
  1670. X    90406
  1671. X
  1672. XCompile with:
  1673. X
  1674. X    cc -DC="R>0" -DI="if(T)O" -DO="c=write(1,&c,1);" -DP="main(){X}"\
  1675. X    -DR="read(0,&c,1)" -DT="c!=015" -DW="while(C)I" -DX="char c;W" markb.c
  1676. X
  1677. XPasses BSD and UTS lint.  At least one version of lint is thrown into
  1678. Xan infinite loop by this entry.
  1679. X
  1680. XTry:  ... | markb | od -c    (remember to compile as indicated above)
  1681. X
  1682. XBy changing the compile line you can make this program do anything you
  1683. Xwant.  This is a very efficient way to transfer source, though it
  1684. Xincreases the size of Makefiles.
  1685. X
  1686. XWith only slight variations, this program can be set to many uses.
  1687. XConsider how easy it would be to release Un*x source in this form;
  1688. Xso what if the make files grow a little!  :-) 
  1689. X
  1690. XOne vendor's lint got hung in an infinite loop over this entry!
  1691. X
  1692. XFYI:  We will let Mark get away with this truly sick entry this time, but 
  1693. X      for the future on we have placed a limit on the size of a compile line.
  1694. X
  1695. XAlso see our comment in Larry Wall's entry regarding Mark's contribution.
  1696. //E*O*F ./1987/biggar.hint//
  1697.  
  1698. echo x - ./1987/heckbert.c
  1699. sed -e 's/^X//' > "./1987/heckbert.c" << '//E*O*F ./1987/heckbert.c//'
  1700. X#include <ctype.h>
  1701. X#include <stdio.h>
  1702. X#define _ define
  1703. X#_ A putchar
  1704. X#_ B return
  1705. X#_ C index
  1706. Xchar*r,c[300001],*d=">=<=!===||&&->++-->><<",*i,*l,*j,*m,*k,*n,*h,*y;e,u=1,v,w,
  1707. Xf=1,p,s,x;main(a,b)char**b;{p=a>1?atoi(b[1]):79;r=c+read(0,j=l=i=c,300000);v=g(
  1708. Xj,&m);for(k=m;v!=2;j=k,m=n,v=w,k=m){w=g(k,&n);if(v==1&&m-j==1&&*j==35)e&&A(10),
  1709. Xe=f=0;if(!f&&v==3&&(char*)C(j,10)<m)A(10),e=0,f=1;else if(v>2&&(u||w)&&(f||u)&&
  1710. X(l-i>1||*i!=61||n-k>1||!C("-*&",*k)))continue;else if(v==3)if(f&&e+1+n-k>p&&e)A
  1711. X(10),e=0;else A(32),e++;else{if(f&&e+m-j>p&&e)A(10),e=0;e+=m-j;k=j;while(k<m)A(
  1712. X*k++);}i=j;l=m;u=v;}e&&A(10);}g(j,m)char*j,**m;{if(j>=r)B*m=j,2;s=isdigit(*j)||
  1713. X*j==46&&isdigit(j[1]);for(h=j;h<r;h++)if(!isalnum(*h)&&*h!=95&&(!s||*h!=46)&&(!
  1714. Xs||h[-1]!=101&&h[-1]!=69||!C("+-",*h)))break;if(h>j)B*m=h,0;x=1;for(h=j;h<r&&C(
  1715. X" \t\n",*h);h++);if(h>j)h--,x=3;if(*j==34||*j==39)for(h=j+1;h<r&&*h!=*j;h++)if(
  1716. X*h==92)h++;for(y=d;*y&&strncmp(y,j,2);y+=2);if(*y)h=j+1;if(!strncmp("/*",j,2)){
  1717. Xh=j+2;while(*++h!=42||*++h!=47);x=4;}*m=h+1;B x;}
  1718. //E*O*F ./1987/heckbert.c//
  1719.  
  1720. echo x - ./1987/heckbert.hint
  1721. sed -e 's/^X//' > "./1987/heckbert.hint" << '//E*O*F ./1987/heckbert.hint//'
  1722. XBest Obfuscator of Programs: <pixar!ph> Paul Heckbert
  1723. X
  1724. X    Paul Heckbert
  1725. X    Pixar
  1726. X
  1727. XTry: ph 40 < ph.c > foo.c; cc foo.c -o ph
  1728. X     ph 20 < a_C_prog.c > bar.c; cc bar.c
  1729. X
  1730. XThe judges used this program to fold up very long lines which the
  1731. XBSD fold(1) was unable to process.  This program has been added
  1732. Xto the contest tool chest.
  1733. X
  1734. XOn System V systems, compile with: -Dindex=strchr.
  1735. XTo compile on a 16 bit machine, change 300000's to 30000.
  1736. //E*O*F ./1987/heckbert.hint//
  1737.  
  1738. echo x - ./1987/hines.c
  1739. sed -e 's/^X//' > "./1987/hines.c" << '//E*O*F ./1987/hines.c//'
  1740. X#include <stdio.h>
  1741. X#include <malloc.h>
  1742. Xmain(togo,toog)
  1743. Xint togo;
  1744. Xchar *toog[];
  1745. X{char *ogto,   tgoo[80];FILE  *ogot;  int    oogt=0, ootg,  otog=79,
  1746. Xottg=1;if (    togo==  ottg)   goto   gogo;  goto    goog;  ggot:
  1747. Xif (   fgets(  tgoo,   otog,   ogot)) goto   gtgo;   goto   gott;
  1748. Xgtot:  exit(); ogtg: ++oogt;   goto   ogoo;  togg:   if (   ootg > 0)
  1749. Xgoto   oggt;   goto    ggot;   ogog:  if (  !ogot)   goto   gogo;
  1750. Xgoto   ggto;   gtto:   printf( "%d    goto   \'s\n", oogt); goto
  1751. Xgtot;  oggt:   if (   !memcmp( ogto, "goto", 4))     goto   otgg;
  1752. Xgoto   gooo;   gogo:   exit(   ottg); tggo:  ootg=   strlen(tgoo);
  1753. Xgoto   tgog;   oogo: --ootg;   goto   togg;  gooo: ++ogto;  goto
  1754. Xoogo;  gott:   fclose( ogot);  goto   gtto;  otgg:   ogto=  ogto +3;
  1755. Xgoto   ogtg;   tgog:   ootg-=4;goto   togg;  gtgo:   ogto=  tgoo;
  1756. Xgoto   tggo;   ogoo:   ootg-=3;goto   gooo;  goog:   ogot=  fopen(
  1757. Xtoog[  ottg],  "r");   goto    ogog;  ggto:  ogto=   tgoo;  goto
  1758. Xggot;}
  1759. //E*O*F ./1987/hines.c//
  1760.  
  1761. echo x - ./1987/hines.hint
  1762. sed -e 's/^X//' > "./1987/hines.hint" << '//E*O*F ./1987/hines.hint//'
  1763. XWorst Style: <grebyn!avalon> Spencer Hines
  1764. X
  1765. X    Spencer Hines
  1766. X    OnLine Computer Systems
  1767. X    4200 Farragut Street
  1768. X    Hyattsville, MD
  1769. X    20781
  1770. X    USA
  1771. X
  1772. XTry:  avalon avalon.c
  1773. X
  1774. XThis program was designed to maximize the bother function for
  1775. Xstructured programmers.  This program takes goto statements to their
  1776. Xlogical conclusion.  The layout and choice of names are classic.
  1777. X
  1778. XWe consider this to be a beautiful counter-example for Frank Rubin's
  1779. Xletter to ACM form titled: `` "GOTO Considered Harmful" Considered Harmful ''.
  1780. XSee the Communications of the ACM, March 1987, Page 195-196.
  1781. //E*O*F ./1987/hines.hint//
  1782.  
  1783. echo x - ./1987/korn.c
  1784. sed -e 's/^X//' > "./1987/korn.c" << '//E*O*F ./1987/korn.c//'
  1785. X    main() { printf(&unix["\021%six\012\0"],(unix)["have"]+"fun"-0x60);}
  1786. //E*O*F ./1987/korn.c//
  1787.  
  1788. echo x - ./1987/korn.hint
  1789. sed -e 's/^X//' > "./1987/korn.hint" << '//E*O*F ./1987/korn.hint//'
  1790. XBest One Liner: <ulysses!dgk> David Korn
  1791. X
  1792. X    David Korn
  1793. X    AT&T Bell Labs
  1794. X    MH 3C-526B, AT&T Bell Labs
  1795. X    Murray Hill, NJ
  1796. X    07974
  1797. X    USA
  1798. X
  1799. XThe Judges believe that this is the best one line entry ever received.
  1800. XCompile on a UN*X system, or at least using a C implementation that
  1801. Xfakes it.  Very few people are able to determine what this program
  1802. Xdoes by visual inspection.  I suggest that you stop reading this
  1803. Xsection right now and see if you are one of the few people who can.
  1804. X
  1805. XSeveral points are important to understand in this program:
  1806. X
  1807. X    1) What is the symbol `unix' and what is its value in the program?
  1808. X       Clearly `unix' is not a function, and since `unix' is not declared
  1809. X       to be a data type (such as int, char, struct foo, enum, ...)
  1810. X       what must `unix' be?
  1811. X
  1812. X    2) What is the value of the symbol "have"?  (hint: the value is
  1813. X       NOT 4 characters, or 'h', or a string)  Consider the fact that:
  1814. X
  1815. X        char *x;
  1816. X
  1817. X      defines a pointer to a character (i.e. an address), and that
  1818. X      the `=' assigns things is compatible types.  Since:
  1819. X
  1820. X            x = "have";
  1821. X
  1822. X      is legal C, what type of value is "have"?
  1823. X
  1824. X    3) Note that the following expressions yield the same value:
  1825. X
  1826. X        x[3]    *(x+3)      *(3+x)
  1827. X
  1828. X       since addition is communitive.  What can be said about the value:
  1829. X
  1830. X        3[x]
  1831. X
  1832. XDavid Korn's /bin/ksh provides us with a greatly improved version of
  1833. Xthe /bin/sh.  The source for v7's /bin/sh greatly inspired this contest.
  1834. //E*O*F ./1987/korn.hint//
  1835.  
  1836. echo x - ./1987/lievaart.c
  1837. sed -e 's/^X//' > "./1987/lievaart.c" << '//E*O*F ./1987/lievaart.c//'
  1838. X#define D define
  1839. X#D Y return
  1840. X#D R for
  1841. X#D e while
  1842. X#D I printf
  1843. X#D l int
  1844. X#D C y=v+111;H(x,v)*y++= *x
  1845. X#D H(a,b)R(a=b+11;a<b+89;a++)
  1846. X#D s(a)t=scanf("%d",&a)
  1847. Xl V[1100],u,r[]={-1,-11,-10,-9,1,11,10,9},h[]={11,18,81,88},ih[]={22,27,72,77},
  1848. Xbz,lv=60,*x,*y,m,t;S(d,v,f,a,b)l*v;{l c=0,*n=v+100,bw=d<u-1?a:-9000,w,z,i,zb,q=
  1849. X3-f;if(d>u){R(w=i=0;i<4;i++)w+=(m=v[h[i]])==f?300:m==q?-300:(t=v[ih[i]])==f?-50
  1850. X:t==q?50:0;return w;}H(z,0){if(GZ(v,z,f,100)){c++;w= -S(d+1,n,q,-b,-bw);if(w>bw
  1851. X){zb=z;bw=w;if(w>=b||w>=8003)Y w;}}}if(!c){bz=0;C;Y-S(d+1,n,q,-b,-bw);}bz=zb;Y
  1852. Xd>=u-1?bw+(c<<3):bw;}main(){R(;t<1100;t+=100)R(m=0;m<100;m++)V[t+m]=m<11||m>88
  1853. X||(m+1)%10<2?3:0;V[44]=V[55]=1;V[45]=V[54]=2;I("Level:");s(u);e(lv>0){do{I("Yo\
  1854. Xu:");s(m);}e(!GZ(V,m,2,0)&&m!=99);if(m!=99)lv--;if(lv<15&&u<10)u+=2;I("Wait\n")
  1855. X;I("Value:%d\n",S(0,V,1,-9000,9000));I("move: %d\n",(lv-=GZ(V,bz,1,0),bz));}}GZ
  1856. X(v,z,f,o)l*v;{l*j,q=3-f,g=0,i,h,*k=v+z;if(*k==0)R(i=7;i>=0;i--){j=k+(h=r[i]);e(
  1857. X*j==q)j+=h;if(*j==f&&j-h!=k){if(!g){g=1;C;}e(j!=k)*((j-=h)+o)=f;}}Y g;}
  1858. //E*O*F ./1987/lievaart.c//
  1859.  
  1860. echo x - ./1987/lievaart.hint
  1861. sed -e 's/^X//' > "./1987/lievaart.hint" << '//E*O*F ./1987/lievaart.hint//'
  1862. XGrand Prize: <botter!rblieva> Roemer B. Lievaart
  1863. X
  1864. X    Roemer B. Lievaart
  1865. X    VU Informatica
  1866. X    Churchilllaan 173-IV
  1867. X    Amsterdam, The Netherlands
  1868. X
  1869. XWe believe that you too will be amazed at just how much power Mr. Lievaart
  1870. Xpacked into 1024 bytes!
  1871. X
  1872. XThis Plays the game of reversi (Othello)!  Compile and run.  It then
  1873. Xasks for a playing level. Enter 0-10 (easy-hard).  It then asks for
  1874. Xyour move. A move is a number within 11-88, or a 99 to pass.  Illegal
  1875. Xmoves (except for an illegal pass) are rejected.  Then the computer
  1876. Xdoes its move (or a 0 to pass), until the board is full.  It plays
  1877. Xrather well, for such a small program!  Lievaart had to leave out the
  1878. Xboard printing routine, so you'll have to take a real game board to
  1879. Xplay it. ...  Also due to space-limitations (the rules for 1987 had a
  1880. Xlimit of 1024 byes), Lievaart took out the passing-handler, which
  1881. Xmakes its ending-game rather poor.  But further it knows all the
  1882. Xrules, uses alpha-beta pruning, and it plays f.i. on mobility(!).
  1883. XMost important: it can play a pretty good game of Reversi!
  1884. X
  1885. XThe Author was kind enough to supply the fully functional version of the
  1886. Xprogram.  The file lievaart2.c contains what the program would have
  1887. Xbeen without the size restriction.  This version has the full end game 
  1888. Xlogic and displays the board after each move!
  1889. //E*O*F ./1987/lievaart.hint//
  1890.  
  1891. echo x - ./1987/lievaart2.c
  1892. sed -e 's/^X//' > "./1987/lievaart2.c" << '//E*O*F ./1987/lievaart2.c//'
  1893. X#define D define
  1894. X#D Y return
  1895. X#D R for
  1896. X#D e while
  1897. X#D I printf
  1898. X#D l int
  1899. X#D W if
  1900. X#D C y=v+111;H(x,v)*y++= *x
  1901. X#D H(a,b)R(a=b+11;a<b+89;a++)
  1902. X#D s(a)t=scanf("%d",&a)
  1903. X#D U Z I
  1904. X#D Z I("123\
  1905. X45678\n");H(x,V){putchar(".XO"[*x]);W((x-V)%10==8){x+=2;I("%d\n",(x-V)/10-1);}}
  1906. Xl V[1600],u,r[]={-1,-11,-10,-9,1,11,10,9},h[]={11,18,81,88},ih[]={22,27,72,77},
  1907. Xbz,lv=60,*x,*y,m,t;S(d,v,f,_,a,b)l*v;{l c=0,*n=v+100,j=d<u-1?a:-9000,w,z,i,g,q=
  1908. X3-f;W(d>u){R(w=i=0;i<4;i++)w+=(m=v[h[i]])==f?300:m==q?-300:(t=v[ih[i]])==f?-50:
  1909. Xt==q?50:0;Y w;}H(z,0){W(E(v,z,f,100)){c++;w= -S(d+1,n,q,0,-b,-j);W(w>j){g=bz=z;
  1910. Xj=w;W(w>=b||w>=8003)Y w;}}}W(!c){g=0;W(_){H(x,v)c+= *x==f?1:*x==3-f?-1:0;Y c>0?
  1911. X8000+c:c-8000;}C;j= -S(d+1,n,q,1,-b,-j);}bz=g;Y d>=u-1?j+(c<<3):j;}main(){R(;t<
  1912. X1600;t+=100)R(m=0;m<100;m++)V[t+m]=m<11||m>88||(m+1)%10<2?3:0;I("Level:");V[44]
  1913. X=V[55]=1;V[45]=V[54]=2;s(u);e(lv>0){Z do{I("You:");s(m);}e(!E(V,m,2,0)&&m!=99);
  1914. XW(m!=99)lv--;W(lv<15&&u<10)u+=2;U("Wait\n");I("Value:%d\n",S(0,V,1,0,-9000,9000
  1915. X));I("move: %d\n",(lv-=E(V,bz,1,0),bz));}}E(v,z,f,o)l*v;{l*j,q=3-f,g=0,i,w,*k=v
  1916. X+z;W(*k==0)R(i=7;i>=0;i--){j=k+(w=r[i]);e(*j==q)j+=w;W(*j==f&&j-w!=k){W(!g){g=1
  1917. X;C;}e(j!=k)*((j-=w)+o)=f;}}Y g;}
  1918. //E*O*F ./1987/lievaart2.c//
  1919.  
  1920. echo x - ./1987/rules
  1921. sed -e 's/^X//' > "./1987/rules" << '//E*O*F ./1987/rules//'
  1922. XWARNING: The rules and mailing address for the contest change from year
  1923. X         to year.  Be sure that you consult the current set of rules
  1924. X     before submitting entries.
  1925. X------------------------------------------------------------------------------
  1926. X
  1927. XSubject: 4th International Obfuscated C Code Contest Rules
  1928. XNewsgroups: comp.lang.c,comp.unix.wizards
  1929. XKeywords: rules,1987,obfuscate,contest
  1930. X
  1931. XGOALS OF THE CONTEST:
  1932. X
  1933. X    * To write the most Obscure/Obfuscated C program under the rules below.
  1934. X    * To show what should NOT be done in C programs.
  1935. X    * To provide a safe forum for poor C code.  :-)
  1936. X
  1937. XRULES:
  1938. X    1) The source must be 1024 characters long or less.  NO EXCEPTIONS!
  1939. X
  1940. X    2) To help us process your entries, we ask that you submit entries
  1941. X       in the following format:   (please include the --- lines)
  1942. X
  1943. X---start of header items---
  1944. Xname:
  1945. Xorg:
  1946. Xemail address:
  1947. Xpostal address:
  1948. Xenvironment:
  1949. Xremarks:
  1950. X---start of entry---
  1951. XX    <place obfuscated source of 1024 characters or less here>
  1952. XX    <add a leading X to each line to avoid problems with mailers>
  1953. XX    <leading X's do not count toward the source character count>
  1954. XX    <the first X of each source line will be removed prior to compilation>
  1955. XX    <newlines count as 1 character>
  1956. XX    <assume a standard 8 character tab stop>
  1957. X---end of entry---
  1958. X
  1959. X    3) Regarding the header items:
  1960. X
  1961. X        * All header items except 'remark' are optional.  If you do not
  1962. X          wish to answer an item, indicate so by the string:   ***NONE***
  1963. X          Any text outside of the above format will be kept confidential.
  1964. X
  1965. X        * You can remain anonymous.   If the name item is:  ***ANONYMOUS***
  1966. X          all items except the 'remarks' item will not be relased.
  1967. X
  1968. X        * Indicate the name of your Company or School in the 'org' item.
  1969. X
  1970. X        * The 'email address' item asks for a network path from a major
  1971. X          site (such as amdahl) to your mailbox.
  1972. X
  1973. X        * If you give a 'postal address', please include your Country.
  1974. X
  1975. X        * Give the machine and operating system (i.e., Un*x version) on
  1976. X          which your program ran.
  1977. X
  1978. X        * The 'remarks' item is not optional.  Please indicate:
  1979. X        - how to execute or compile if something special is required
  1980. X        - type of input or argument needed, if applicable
  1981. X        - what this program does
  1982. X        - any other remarks you wish to make
  1983. X
  1984. X        * If you need more than one line on a header item, place
  1985. X          tab or space characters at the beginning of each additional line.
  1986. X
  1987. X    4) The entry should be written in a common C. (K&R + common extensions)
  1988. X
  1989. X    5) The program must be of original work.  All programs must be
  1990. X       in the public domain.  All copyrighted programs will be rejected.
  1991. X
  1992. X    6) Entries must be received before 30-May-87 0:00 GMT.
  1993. X       Email your entries to:
  1994. X       
  1995. X            ...!amdahl!obfuscate
  1996. X
  1997. X       Amdahl talks to hplabs, decwrl, pyramid, seismo and cbosgd.
  1998. X       We will attempt to Email a confirmation of receipt of contest
  1999. X       entries, however since Email is not reliable you may not receive it.
  2000. X       People are encouraged to submit entries via Email, however
  2001. X       one may mail entries the following postal address:
  2002. X
  2003. X        Landon Curt Noll
  2004. X        Amdahl Corp.
  2005. X        1250 E. Arques Ave.   M/S 316
  2006. X        P.O. Box 3470
  2007. X        Sunnyvale, CA
  2008. X        94088-3470
  2009. X        U.S.A.
  2010. X
  2011. X      Write the words: "International Obfuscated C Code Contest" near the
  2012. X      bottom left corner of the envelope.
  2013. X
  2014. X    8) Contest entries sent in by post should indicate where TAB characters
  2015. X       are to be placed, otherwise space characters will be assumed.  Each
  2016. X       line will be assumed to contain a newline character.  The leading
  2017. X       'X' will serve to indicate where each source line starts.
  2018. X
  2019. X    9) Each person may submit up to 5 entries.  Multiple entries must
  2020. X       be sent in separate Email letters or postal envelopes.
  2021. X
  2022. X    10) People are encouraged to examine winners of the previous
  2023. X        contests.  A copy of these entries was posted to mod.sources
  2024. X        on or about 12-Mar-87.  Contact the mod.sources moderator
  2025. X        if you missed that article.  Keep in mind that rules change from
  2026. X        year to year, so some winning entries may not be valid
  2027. X        entries this year.  Also what was unique and novel one
  2028. X        year can get 'old' the next year.
  2029. X
  2030. X
  2031. XANNOUNCEMENT OF WINNERS:
  2032. X
  2033. X    * First announcement will be at the Summer 87 Usenix BOF.
  2034. X
  2035. X    * An announcement will be posted to mod.announce near
  2036. X      mid June 1987 stating to which newsgroup the winners
  2037. X      have been posted.
  2038. X
  2039. X    * An article containing the winning entries will be published
  2040. X      in a future issue of the "Micro/Systems Journal".
  2041. X
  2042. X    * Winners receive international fame and flames!  :-)
  2043. X
  2044. X
  2045. XJUDGING:
  2046. X    Awards will be given to the best entry in a number of categories.
  2047. X    The actual category list will vary depending on the types of entries
  2048. X    we receive.  At the moment, we are considering using the following:
  2049. X
  2050. X        * The best small one line program
  2051. X        * The most obscure algorithm
  2052. X        * The worst abuse of the C preprocessor  (note warnings below)
  2053. X        * The strangest source layout
  2054. X        * The most useful obfuscated program
  2055. X        * <anything else so strange that it deserves an award>
  2056. X
  2057. X    Extra points will be given for programs which:
  2058. X
  2059. X        * pass lint without complaint
  2060. X        * do something quasi-interesting
  2061. X        * are portable
  2062. X        * are unique in their obfuscation style
  2063. X        * are concise
  2064. X
  2065. X    Points will be taken away for programs that:
  2066. X
  2067. X        * are very hardware or Un*x version specific
  2068. X        * dump core or have compiler warnings
  2069. X          (we won't take points away if you warn us in the remark item)
  2070. X        * fail to compile
  2071. X        * obfuscate only by overuse of #defines
  2072. X          (you should do this ONLY if your use is unusual)
  2073. X        * are similar to previous winners
  2074. X        * are similar to previous losers  :-)
  2075. X
  2076. X    The Judging will be done by Landon Noll and Larry Bassel.  
  2077. X    Comments & questions (not entries) about the contest can be Emailed to:
  2078. X
  2079. X             ...!amdahl!judges
  2080. X
  2081. Xchongo <Landon Curt Noll> /\cc/\
  2082. XLarry Bassel
  2083. //E*O*F ./1987/rules//
  2084.  
  2085. echo x - ./1987/wall.c
  2086. sed -e 's/^X//' > "./1987/wall.c" << '//E*O*F ./1987/wall.c//'
  2087. X#define iv 4 
  2088. X#define v ;(void
  2089. X#define XI(xi)int xi[iv*'V'];
  2090. X#define L(c,l,i)c(){d(l);m(i);}
  2091. X#include <stdio.h>
  2092. Xint*cc,c,i,ix='\t',exit(),X='\n'*'\d';XI(VI)XI(xi)extern(*vi[])(),(*
  2093. Xsignal())();char*V,cm,D['x'],M='\n',I,*gets();L(MV,V,(c+='d',ix))m(x){v)
  2094. Xsignal(X/'I',vi[x]);}d(x)char*x;{v)write(i,x,i);}L(MC,V,M+I)xv(){c>=i?m(
  2095. Xc/M/M+M):(d(&M),m(cm));}L(mi,V+cm,M)L(md,V,M)MM(){c=c*M%X;V-=cm;m(ix);}
  2096. XLXX(){gets(D)||(vi[iv])();c=atoi(D);while(c>=X){c-=X;d("m");}V="ivxlcdm"
  2097. X+iv;m(ix);}LV(){c-=c;while((i=cc[*D=getchar()])>-I)i?(c?(c<i&&l(-c-c,
  2098. X"%d"),l(i,"+%d")):l(i,"(%d")):(c&&l(M,")"),l(*D,"%c")),c=i;c&&l(X,")"),l
  2099. X(-i,"%c");m(iv-!(i&I));}L(ml,V,'\f')li(){m(cm+!isatty(i=I));}ii(){m(c=cm
  2100. X= ++I)v)pipe(VI);cc=xi+cm++;for(V="jWYmDEnX";*V;V++)xi[*V^' ']=c,xi[*V++]
  2101. X=c,c*=M,xi[*V^' ']=xi[*V]=c>>I;cc[-I]-=ix v)close(*VI);cc[M]-=M;}main(){
  2102. X(*vi)();for(;v)write(VI[I],V,M));}l(xl,lx)char*lx;{v)printf(lx,xl)v)
  2103. Xfflush(stdout);}L(xx,V+I,(c-=X/cm,ix))int(*vi[])()={ii,li,LXX,LV,exit,l,
  2104. Xd,l,d,xv,MM,md,MC,ml,MV,xx,xx,xx,xx,MV,mi};
  2105. //E*O*F ./1987/wall.c//
  2106.  
  2107. echo x - ./1987/wall.hint
  2108. sed -e 's/^X//' > "./1987/wall.hint" << '//E*O*F ./1987/wall.hint//'
  2109. XMost Useful Obfuscation: <sdcrdcf!lwall> Larry Wall
  2110. X
  2111. X    Larry Wall
  2112. X    Unisys - System Development Group Santa Monica
  2113. X    9132 Kester Ave
  2114. X    Panorama City, CA  91402  USA
  2115. X
  2116. XTry:    lwall | bc | lwall
  2117. Xinput:    x*x
  2118. Xinput:    c^2
  2119. X
  2120. XAlso try:  lwall | bc   and   lwall | cat
  2121. X
  2122. XWhat we found amazing was how the flow of control was transferred
  2123. Xbetween subroutines.  Careful inspection will show that the array of
  2124. Xpointers to functions named `vi' refers to functions which seem to not
  2125. Xbe directly called.  Even so, these pointers to functions are being
  2126. Xused as an argument to signal.  Can you determine why this is being
  2127. Xdone and how it is being exploited?
  2128. X
  2129. XSome compilers complained about this file, so we changed: '=++I' to '= ++I'.
  2130. //E*O*F ./1987/wall.hint//
  2131.  
  2132. echo x - ./1987/westley.c
  2133. sed -e 's/^X//' > "./1987/westley.c" << '//E*O*F ./1987/westley.c//'
  2134. X                char rahc
  2135. X                   [ ]
  2136. X                    =
  2137. X                  "\n/"
  2138. X                    ,
  2139. X                redivider
  2140. X                   [ ]
  2141. X                    =
  2142. X               "Able was I ere I saw elbA"
  2143. X                    ,
  2144. X                    *
  2145. X                 deliver,reviled
  2146. X                    =
  2147. X                   1+1
  2148. X                    ,
  2149. X                   niam ; main
  2150. X                   ( )
  2151. X                  {/*\}
  2152. X                   \*/
  2153. X                 int tni
  2154. X                    =
  2155. X                   0x0
  2156. X                    ,
  2157. X                 rahctup,putchar
  2158. X                   ( )
  2159. X                   ,LACEDx0 = 0xDECAL,
  2160. X                rof ; for
  2161. X                 (;(int) (tni);)
  2162. X                   (int) (tni)
  2163. X              = reviled ; deliver =
  2164. X                redivider
  2165. X                    ;
  2166. Xfor ((int)(tni)++,++reviled;reviled* *deliver;deliver++,++(int)(tni)) rof
  2167. X                        =
  2168. X                 (int) -1- (tni)
  2169. X                  ;reviled--;--deliver;
  2170. X                 (tni)  =  (int)
  2171. X              - 0xDECAL + LACEDx0 -
  2172. X                rof ; for
  2173. X       (reviled--,(int)--(tni);(int) (tni);(int)--(tni),--deliver)
  2174. X                rahctup = putchar
  2175. X               (reviled* *deliver)
  2176. X                    ;
  2177. X                rahctup * putchar
  2178. X                ((char) * (rahc))
  2179. X                    ;
  2180. X                   /*\
  2181. X                  {\*/}
  2182. //E*O*F ./1987/westley.c//
  2183.  
  2184. echo x - ./1987/westley.hint
  2185. sed -e 's/^X//' > "./1987/westley.hint" << '//E*O*F ./1987/westley.hint//'
  2186. XBest Layout: <starfire!merlyn> Brian Westley
  2187. X
  2188. X    Brian Westley (aka Merlyn Leroy on usenet)
  2189. X    Starfire Consulting
  2190. X    1121 Hamline Ave. N. #17
  2191. X    St. Paul, MN
  2192. X    55108
  2193. X    USA
  2194. X
  2195. XPutchar must exist in the C library and not just as a macro.
  2196. XIf it fails to compile, add the line:  #include <stdio.h>  at the
  2197. Xtop of the program.
  2198. X
  2199. XLine by line symmetry performed better than any C beautifier.  Think
  2200. Xof if it as a C ink blot.  :-)
  2201. //E*O*F ./1987/westley.hint//
  2202.  
  2203. echo Possible errors detected by \'wc\' [hopefully none]:
  2204. temp=/tmp/shar$$
  2205. trap "rm -f $temp; exit" 0 1 2 3 15
  2206. cat > $temp <<\!!!
  2207.  40  112  726  Makefile
  2208.  15  136  816  README
  2209.  1  1  3  biggar.c
  2210.  32  191  1141  biggar.hint
  2211.  18  33  1021  heckbert.c
  2212.  14  76  430  heckbert.hint
  2213.  19  130  953  hines.c
  2214.  18  82  565  hines.hint
  2215.  1  3  70  korn.c
  2216.  44  242  1401  korn.hint
  2217.  20  44  1022  lievaart.c
  2218.  27  224  1303  lievaart.hint
  2219.  25  61  1175  lievaart2.c
  2220.  161  917  5745  rules
  2221.  18  30  1021  wall.c
  2222.  21  120  708  wall.hint
  2223.  48  93  908  westley.c
  2224.  15  73  412  westley.hint
  2225.  537  2568  19420  total
  2226. !!!
  2227. wc  ./1987/Makefile ./1987/README ./1987/biggar.c ./1987/biggar.hint ./1987/heckbert.c ./1987/heckbert.hint ./1987/hines.c ./1987/hines.hint ./1987/korn.c ./1987/korn.hint ./1987/lievaart.c ./1987/lievaart.hint ./1987/lievaart2.c ./1987/rules ./1987/wall.c ./1987/wall.hint ./1987/westley.c ./1987/westley.hint | sed 's=[^ ]*/==' | diff -b $temp -
  2228. exit 0
  2229.  
  2230. -- 
  2231. Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
  2232. Path: killer!osu-cis!tut.cis.ohio-state.edu!rutgers!gatech!bbn!bbn.com!rsalz
  2233. From: rsalz@uunet.uu.net (Rich Salz)
  2234. Newsgroups: comp.sources.unix,comp.lang.c
  2235. Subject: v15i111:  International Obfuscated C Code Contest, Part07/07
  2236. Message-ID: <1014@fig.bbn.com>
  2237. Date: 2 Aug 88 20:42:16 GMT
  2238. Lines: 1305
  2239. Approved: rsalz@uunet.UU.NET
  2240. Xref: killer comp.sources.unix:640 comp.lang.c:11609
  2241.  
  2242. Submitted-by: Landon Curt Noll <chongo@uts.amdahl.com>
  2243. Posting-number: Volume 15, Issue 111
  2244. Archive-name: ioccc/part07
  2245.  
  2246. # This is a shell archive.  Remove anything before this line, then
  2247. # unpack it by saving it in a file and typing "sh file".  (Files
  2248. # unpacked will be owned by you and have default permissions.)
  2249. #
  2250. # This archive contains:
  2251. # ./1988/Makefile ./1988/README ./1988/applin.c ./1988/applin.hint
  2252. # ./1988/dale.c ./1988/dale.hint ./1988/isaak.c ./1988/isaak.encode
  2253. # ./1988/isaak.hint ./1988/litmaath.c ./1988/litmaath.hint
  2254. # ./1988/phillipps.c ./1988/phillipps.hint ./1988/reddy.c
  2255. # ./1988/reddy.hint ./1988/robison.c ./1988/robison.hint ./1988/rules
  2256. # ./1988/spinellis.c ./1988/spinellis.data ./1988/spinellis.hint
  2257. # ./1988/westley.c ./1988/westley.hint ./1988/zsmall.c
  2258.  
  2259. echo x - ./1988/Makefile
  2260. sed -e 's/^X//' > "./1988/Makefile" << '//E*O*F ./1988/Makefile//'
  2261. X# %W% %G% %U%
  2262. X#
  2263. X# 1988 makefile
  2264. X
  2265. XSHELL=/bin/sh
  2266. XCFLAGS=-O
  2267. XCC=cc
  2268. XCPP=/lib/cpp
  2269. X# you may need a version of cpp that is faster and/or allows more symbols
  2270. X# than the standard cpp.  If so, adjust the BIG_CPP below.
  2271. X#
  2272. X# If you have the GNU cpp, you should use it below as it is MUCH faster
  2273. X# than the standard cpp and does not have problems with memory usage.
  2274. X# However you should note that the non-ANSI nature of defining symbols
  2275. X# that start with '#' prevents GNU cpp from doing the initial pass.  
  2276. X# Thus you should not use the GNU cpp for the ${CPP} symbol.
  2277. XBIG_CPP=${CPP}
  2278. X
  2279. XWINNERS=dale phillipps robison westley reddy isaak \
  2280. X    litmaath spinellis zsmall
  2281. X
  2282. Xall: ${WINNERS}
  2283. X
  2284. Xdale: dale.c
  2285. X    ${CC} ${CFLAGS} $? -o $@
  2286. Xphillipps: phillipps.c
  2287. X    ${CC} ${CFLAGS} $? -o $@
  2288. Xrobison: robison.c
  2289. X    ${CC} ${CFLAGS} $? -o $@
  2290. Xwestley: westley.c
  2291. X    ${CC} ${CFLAGS} $? -o $@
  2292. Xreddy: reddy.c
  2293. X    ${CC} ${CFLAGS} $? -o $@
  2294. Xisaak: isaak.c
  2295. X    ${CC} ${CFLAGS} -DI=B -DO=- -Dy $? -o $@
  2296. Xlitmaath: litmaath.c
  2297. X    ${CC} ${CFLAGS} $? -o $@
  2298. Xspinellis: spinellis.c spinellis.data
  2299. X    @echo This program can not be portably compiled with a makefile
  2300. X    @echo because it reads from /dev/tty.
  2301. X    @echo Compile this program with: cc spinellis.c -o spinellis
  2302. X    @echo and type the following text followed by an EOF '(^D)'.
  2303. X    @cat spinellis.data
  2304. X    @-if [ ! -f spinellis ]; then \
  2305. X        touch spinellis; \
  2306. X    fi
  2307. X
  2308. X# not an official entry
  2309. X#
  2310. X# The 'zsmall.c' program was obtained from 'applin.c' by reducing its recursion
  2311. X# and running it thru the initial /lib/cpp.  That is, 'zsmall.c' is a small
  2312. X# version of the 'z.c' file as produced by the 'applin' make rule below.
  2313. Xzsmall: zsmall.c
  2314. X    @echo this reduced version of applin.c can take some time to compile...
  2315. X    ${CC} ${CFLAGS} zsmall.c -o $@
  2316. X
  2317. X# This entry took 75 minutes to compile on a Amdahl 5980-300E
  2318. X# (a 55658 Dhyrstone/sec/cpu machine) using the System V cpp.
  2319. X# (The GNU cpp when defined as BIG_CPP took only 45 seconds)
  2320. X# Your cpp may not be able to compile it due to a common bug
  2321. X# that results in ${CPP} running out of space.  The routine
  2322. X# 'zsmall' is a smaller version of the applin.c entry.
  2323. Xapplin: applin.c
  2324. X    ${CPP} '-DM=#include "z.c"' '-DR=#include' '-DF=#if' \
  2325. X        '-DI=#ifdef' '-DL=#else' '-DE=#endif' '-DN=#ifndef' \
  2326. X        '-DD=#define' '-DU=#undef' applin.c z.c
  2327. X    @echo this is going to take a very very long time to C-preprocess
  2328. X    @echo perhaps you should do:  make zsmall   instead
  2329. X    ${BIG_CPP} z.c > large.c
  2330. X    @echo now for the real compile...
  2331. X    ${CC} ${CFLAGS} large.c -o $@
  2332. X
  2333. Xclean:
  2334. X    rm -f core *.o
  2335. Xclobber: clean
  2336. X    rm -f ${WINNERS} applin
  2337. Xnuke: clobber
  2338. X    rm -f large.c z.c
  2339. Xinstall: all
  2340. X    cat ${WINNERS} > /dev/null
  2341. //E*O*F ./1988/Makefile//
  2342.  
  2343. echo x - ./1988/README
  2344. sed -e 's/^X//' > "./1988/README" << '//E*O*F ./1988/README//'
  2345. X1988 marked the "The Fifth International Obfuscated C Code Contest"
  2346. X
  2347. XThe maximum size of entries was raised from 1024 to 1536 bytes, however
  2348. Xsmaller entries were encouraged.  Due to the "Best Abuse of the Rules"
  2349. Xwinner of 1987, a limit of 160 chars in the compile line was introduced.
  2350. X
  2351. XThis year, the Grand Prize was given to the most unusual entry and best
  2352. Xabuse of the C Preprocessor rather than the most well rounded entry.
  2353. X
  2354. XRules and results were posted to comp.lang.c, comp.sources.unix and
  2355. Xalt.sources.  The 1988 winners will be published in the Micro/Systems 
  2356. XJournal.  
  2357. X
  2358. XWinning entries for previous years were repackaged with each year
  2359. Xbeing in its own directory.  Make files and hints were also provided.
  2360. XThe package was posted to the: comp.sources.unix newsgroup.  They are
  2361. Xalso available on a wide number of Usenet archive sites.
  2362. //E*O*F ./1988/README//
  2363.  
  2364. echo x - ./1988/applin.c
  2365. sed -e 's/^X//' > "./1988/applin.c" << '//E*O*F ./1988/applin.c//'
  2366. XI a
  2367. XU a
  2368. XI b
  2369. XU b
  2370. XI c
  2371. XU c
  2372. XI d
  2373. XU d
  2374. XI e
  2375. XU e
  2376. XI f
  2377. XU f
  2378. XI g
  2379. XU g
  2380. XI h
  2381. XU h
  2382. XI i
  2383. XU i
  2384. XI j
  2385. XU j
  2386. XI k
  2387. XU k
  2388. XI l
  2389. XU l
  2390. XI m
  2391. XU m
  2392. XL
  2393. XD m
  2394. XE
  2395. XL
  2396. XD l
  2397. XE
  2398. XL
  2399. XD k
  2400. XE
  2401. XL
  2402. XD j
  2403. XE
  2404. XL
  2405. XD i
  2406. XE
  2407. XL
  2408. XD h
  2409. XE
  2410. XL
  2411. XD g
  2412. XE
  2413. XL
  2414. XD f
  2415. XE
  2416. XL
  2417. XD e
  2418. XE
  2419. XL
  2420. XD d
  2421. XE
  2422. XL
  2423. XD c
  2424. XE
  2425. XL
  2426. XD b
  2427. XE
  2428. XL
  2429. XD a
  2430. XE
  2431. XI m
  2432. XD n (1<<9)
  2433. XL
  2434. XD n 0
  2435. XE
  2436. XI l
  2437. XD o (1<<8)
  2438. XL
  2439. XD o 0
  2440. XE
  2441. XI k
  2442. XD p (1<<7)
  2443. XL
  2444. XD p 0
  2445. XE
  2446. XI j
  2447. XD q (1<<6)
  2448. XL
  2449. XD q 0
  2450. XE
  2451. XI i
  2452. XD r (1<<5)
  2453. XL
  2454. XD r 0
  2455. XE
  2456. XI h
  2457. XD s (1<<4)
  2458. XL
  2459. XD s 0
  2460. XE
  2461. XI g
  2462. XD t (1<<3)
  2463. XL
  2464. XD t 0
  2465. XE
  2466. XI f
  2467. XD u (1<<2)
  2468. XL
  2469. XD u 0
  2470. XE
  2471. XI e
  2472. XD v (1<<1)
  2473. XL
  2474. XD v 0
  2475. XE
  2476. XD vv (n+o+p+q+r+s+t+u+v+1)
  2477. XD ff (defined(d)*16+defined(c)*8+defined(b)*4+defined(a)*2+1)
  2478. XF vv==1
  2479. XU vv
  2480. XD vv 2
  2481. XE
  2482. XF ff<vv 
  2483. XF ff!=1
  2484. XF (vv/ff)*ff==vv 
  2485. XN dd
  2486. XD dd
  2487. XE
  2488. XE
  2489. XE
  2490. XE
  2491. XF ff==31
  2492. XI dd
  2493. XU dd
  2494. XL
  2495. Xprintf("%d\n", vv);
  2496. XE
  2497. XE
  2498. XU ff
  2499. XU vv
  2500. XU n
  2501. XU o
  2502. XU p
  2503. XU q
  2504. XU r
  2505. XU s
  2506. XU t
  2507. XU u
  2508. XU v
  2509. XI w
  2510. XI x
  2511. XI y
  2512. XN z
  2513. XD z
  2514. XE
  2515. XL
  2516. XD y
  2517. XE
  2518. XL
  2519. XD x
  2520. XE
  2521. XL
  2522. XD w
  2523. XR <stdio.h>
  2524. Xmain(){
  2525. XE
  2526. XN z
  2527. XM
  2528. XM
  2529. XM
  2530. XM
  2531. XM
  2532. XM
  2533. XM
  2534. XM
  2535. XM
  2536. XM
  2537. XM
  2538. XM
  2539. XM
  2540. XM
  2541. XM
  2542. XE
  2543. XI z
  2544. XU z
  2545. XL
  2546. XI y
  2547. XU y
  2548. XL
  2549. XI x
  2550. XU x
  2551. XL
  2552. XI w
  2553. XU w
  2554. X}
  2555. XE
  2556. XE
  2557. XE
  2558. XE
  2559. //E*O*F ./1988/applin.c//
  2560.  
  2561. echo x - ./1988/applin.hint
  2562. sed -e 's/^X//' > "./1988/applin.hint" << '//E*O*F ./1988/applin.hint//'
  2563. XBest of show: <hpfclg!neutron> Jack Applin
  2564. X
  2565. X        Jack Applin
  2566. X    Hewlett-Packard
  2567. X    3404 E. Harmony Rd
  2568. X    Ft. Collins, CO 
  2569. X    80525 
  2570. X    USA
  2571. X
  2572. XCompile and execute with no argument, if you can!
  2573. X
  2574. XThis entry is by far the most unusual abuse of the C preprocessor that
  2575. Xwe have received thus far.  Nearly all of the real work is done in the
  2576. Xpreprocessor!
  2577. X
  2578. XWhen we compiled applin.c on an Amdahl 5890-300E, we found that it
  2579. Xspent over 75 minutes in the System V C preprocessor!  Besides showing
  2580. Xthat the standard System V cpp is slow, it showed that it contained a
  2581. Xmemory usage problem.  The applin.c only uses 29 different preprocessor
  2582. Xsymbols (besides <stdio.h> and yet the preprocessor ran out of space!
  2583. X
  2584. XThe GNU C preprocessor took less than 45 seconds to perform the 2nd pass 
  2585. Xon the Amdahl 5890-300E.  But due to the ANSI-ness of GNU cpp (v.  1-21), 
  2586. Xit was not able to cleanly substitute a symbol that began with a '#'.
  2587. XClearly the GNU C preprocessor is faster.
  2588. X
  2589. XA smaller version of applin.c can be found in zsmall.c.  Your machine
  2590. Xmay have an easier time with this program.  See the Makefile for details.
  2591. //E*O*F ./1988/applin.hint//
  2592.  
  2593. echo x - ./1988/dale.c
  2594. sed -e 's/^X//' > "./1988/dale.c" << '//E*O*F ./1988/dale.c//'
  2595. X#define _ define
  2596. X#_ P char
  2597. X#_ p int
  2598. X#_ O close(
  2599. X#_ H strlen(*
  2600. X#_ h case_2
  2601. X#_ case_3 default
  2602. X#_ while switch
  2603. X#_ L if
  2604. X#_ I goto
  2605. X#_ l 1
  2606. X#_ f write
  2607. X#_ J else
  2608. X#_ a(x)get/***/x/***/id())
  2609. XP z[l<<(1<<l<<1)<<1<<(l<<1)<<(l<<l<<l)<<1],*v;p r,A=0,c=1;
  2610. Xq(Q)P*Q;{L(*++Q){*Q-=7;q(Q);}}main(V,C)P**C;{
  2611. Xp Z=chroot("/");L(!a(u)execv((q(v="/ipu6ljov"),v),C);Z-=kill(l);
  2612. Xwhile(V){
  2613. Xcase_3:L(!(*C[c]-'-')&&!(C[c][c]-'n')&&!C[c][c<<c])V--,C++,Z=c;
  2614. Xcase 1:O/*/*/0)+O(c*c-c+c/c)<<(c*c));dup(c);O/*/*/c);pipe(z);L(
  2615. X    for/*/(;;);/*/k()){O/*/*/c);
  2616. Xcase_2:L(!--V){O/*/*/c*c+c);wait(A+c*c-c);L(!Z)f(A,"\n",c);return(A*a(g);};C++;
  2617. X    f(c/c+c*c,*C,H C));I h;}J O/*/*/c/c+V/V+A*(p)C);
  2618. Xcase 0:c=read(1,z,r=H++C));L(c){L(A++)f('-'-'-'-'+'+'+'," ",'/'/'/');
  2619. X    f(A-A+c-r-c+r,z,r);}J _exit(Z?Z-Z:Z);};main(chroot("/tmp")+l,C);
  2620. X}
  2621. //E*O*F ./1988/dale.c//
  2622.  
  2623. echo x - ./1988/dale.hint
  2624. sed -e 's/^X//' > "./1988/dale.hint" << '//E*O*F ./1988/dale.hint//'
  2625. XBest abuse of system calls: <grue@banana.cs.uq.oz>  Paul Dale
  2626. X
  2627. X        Paul Dale
  2628. X    University of Queensland
  2629. X    Computer Science Dept
  2630. X    Dept of Computer Science
  2631. X    Uni of Qld, 4067
  2632. X    Australia
  2633. X
  2634. XTry: dale hello world
  2635. X     dale these files are in this directory: *
  2636. X
  2637. XThis entry has a very twisted flow of control via recursion, iteration 
  2638. Xand multi-processing.  Try to understand what is being done with the
  2639. Xsystem calls.
  2640. X
  2641. XNOTE: This program assumes the ascii character set is being used.
  2642. //E*O*F ./1988/dale.hint//
  2643.  
  2644. echo x - ./1988/isaak.c
  2645. sed -e 's/^X//' > "./1988/isaak.c" << '//E*O*F ./1988/isaak.c//'
  2646. Xmain(){}
  2647. X#define P define
  2648. X#P U ifdef
  2649. X#P main Si
  2650. X#U y
  2651. X#undef y
  2652. X#include "isaak.c"
  2653. XPb
  2654. X#else
  2655. Xchar*K="4499999;8    9+jW*':'TZhD m:*h.4-j'9(z7Q>r*:G#FS]mATIdMZY^HaKFZZ\
  2656. XJyJw:X49@eJj1,Z'\\c^jGU@IXTF@9P2i:gAZx0pD*W3\\<ZZs1:.~Z8U:P<\\:ZOI0GBPZ7",*H
  2657. X,S[5202],*B="oA9BA6iN`]`Ph>5F4::M6A69@6I{g[Za__]NPV``aV\177E4C5CG;4C<BEJG;\
  2658. X?LGlSZ[Y_!oYi@uXPzLFyPOYP][]`RTaQo86564CAHCG4ES",*F,N;int Bk,V;Y
  2659. X#endif
  2660. X#P C K/16-2
  2661. X(){char*H;F O= -263;for(H="$+---+|||";*++H;)*(F O=(*H+5&129)+1)= *H;F
  2662. X#P W sprintf(
  2663. XO= -132;}I/**/r(){if((N= *I O/**/O%(21 O -5)+81 O 16)==107)N+=
  2664. X#undef I
  2665. X*K++&15;*F++ =N;return*K;}
  2666. X#undef O
  2667. X#P I K
  2668. X#P O +
  2669. X#U N
  2670. Xexit(N){F=W H=S,"%5060d")+385;while(Br(),++B,Kr())F+=(N=
  2671. X*B++/26-1)?(")21["[N]-46)*N*4-22:-3194;while(*--K!=9){while(!(*++H+5&64));
  2672. XF=(40-"(\206/"[((H-S)%130+45)/57]<<3)+H;*F++= *H++;*F=
  2673. X*H==106?32:*H;Y();W W F-131,"%-3d",++Bk)+260,"%3d",V+=
  2674. X*C?*C:"hijpqv"[*--C]-106);Pb();}for(H=S;*H||(int)_exit(0);H+=130)write(1,1+W
  2675. XF+3,"%c%-73.73s\n",0,H),74);}
  2676. X#endif
  2677. X#undef U
  2678. X#P U ifndef
  2679. X#include <stdio.h>
  2680. //E*O*F ./1988/isaak.c//
  2681.  
  2682. echo x - ./1988/isaak.encode
  2683. sed -e 's/^X//' > "./1988/isaak.encode" << '//E*O*F ./1988/isaak.encode//'
  2684. Xbegin 666 isaak.output
  2685. XM*RTM+2L@(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
  2686. XM(" @(" @(" @(" @(" @(" @(" @(" K+2TM*PI\,2 @?" @(" @(" @(" @
  2687. XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
  2688. XM(" @(" @('PR("!\"GQ(("!\(" @(" @(" @(" @(" @(" @(" @(" @(" @
  2689. XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @?$AE('P*?" @
  2690. XM,7P@(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
  2691. XM(" @(" @(" @(" @(" @(" @("!\(" T? HK+2TM*RTM+2L@(" @(" @(" @
  2692. XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" K+2TM*RTM+2LM+2TK+2TM
  2693. XM*RTM+2LM+2TK"GPS("!\-" @?" @(" @(" @(" @(" @(" @(" @(" @(" @
  2694. XM(" @(" @(" @(" @('PU("!\-B @?#<@('PX("!\.2 @?#$P('P*?$QI('Q"
  2695. XM92!\(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @?$(@
  2696. XM('Q#("!\3B @?$\@('Q&("!\3F4@? I\(" W?" @.7P@(" @(" @(" @(" @
  2697. XM(" @(" @(" @(" @(" @(" @(" @(" @("!\(#$Q?" Q,GP@,31\(#$V?" Q
  2698. XM.7P@,C!\"BLM+2TK+2TM*R @(" @(" @(" @(" @(" @(" @(" @(" @(" @
  2699. XM(" @(" @(" @("LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2L*?#$Q('PQ,B!\
  2700. XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @?#$S('PQ
  2701. XM-"!\,34@?#$V('PQ-R!\,3@@? I\3F$@?$UG('P@(" @(" @(" @(" @(" @
  2702. XM(" @(" @(" @(" @(" @(" @(" @("!\06P@?%-I('Q0("!\4R @?$-L('Q!
  2703. XM<B!\"GP@,C-\(#(T?" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
  2704. XM(" @(" @('P@,C=\(#(X?" S,7P@,S)\(#,U?" T,'P**RTM+2LM+2TK+2TM
  2705. XM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK
  2706. XM+2TM*RTM+2LM+2TK+2TM*PI\,3D@?#(P('PR,2!\,C(@?#(S('PR-"!\,C4@
  2707. XM?#(V('PR-R!\,C@@?#(Y('PS,"!\,S$@?#,R('PS,R!\,S0@?#,U('PS-B!\
  2708. XM"GQ+("!\0V$@?%-C('Q4:2!\5B @?$-R('Q-;B!\1F4@?$-O('Q.:2!\0W4@
  2709. XM?%IN('Q'82!\1V4@?$%S('Q392!\0G(@?$MR('P*?" S.7P@-#!\(#0U?" T
  2710. XM.'P@-3%\(#4R?" U-7P@-39\(#4Y?" U.7P@-C1\(#8U?" W,'P@-S-\(#<U
  2711. XM?" W.7P@.#!\(#@T? HK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM
  2712. XM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK"GPS
  2713. XM-R!\,S@@?#,Y('PT,"!\-#$@?#0R('PT,R!\-#0@?#0U('PT-B!\-#<@?#0X
  2714. XM('PT.2!\-3 @?#4Q('PU,B!\-3,@?#4T('P*?%)B('Q3<B!\62 @?%IR('Q.
  2715. XM8B!\36\@?%1C('Q2=2!\4F@@?%!D('Q!9R!\0V0@?$EN('Q3;B!\4V(@?%1E
  2716. XM('Q)("!\6&4@? I\(#@U?" X.'P@.#E\(#DQ?" Y,WP@.39\(#DY?#$P,7PQ
  2717. XM,#-\,3 V?#$P.'PQ,3)\,3$U?#$Q.7PQ,C)\,3(X?#$R-WPQ,S%\"BLM+2TK
  2718. XM+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM
  2719. XM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2L*?#4U('PU-B!\-3<@?#<R('PW,R!\
  2720. XM-S0@?#<U('PW-B!\-S<@?#<X('PW.2!\.# @?#@Q('PX,B!\.#,@?#@T('PX
  2721. XM-2!\.#8@? I\0W,@?$)A('Q,82!\2&8@?%1A('Q7("!\4F4@?$]S('Q)<B!\
  2722. XM4'0@?$%U('Q(9R!\5&P@?%!B('Q":2!\4&\@?$%T('Q2;B!\"GPQ,S-\,3,W
  2723. XM?#$S.7PQ-SA\,3@Q?#$X-'PQ.#9\,3DP?#$Y,GPQ.35\,3DW?#(P,7PR,#1\
  2724. XM,C W?#(P.7PR,#E\,C$P?#(R,GP**RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM
  2725. XM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK
  2726. XM+2TM*PI\.#<@?#@X('PX.2!\,3 T?#$P-7P@(" @(" @(" @(" @(" @(" @
  2727. XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @"GQ&<B!\4F$@?$%C
  2728. XM('Q29B!\2&$@?" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
  2729. XM(" @(" @(" @(" @(" @(" *?#(R,WPR,C9\,C(W?#(V,7PR-C!\(" @(" @
  2730. XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
  2731. XM( HK+2TM*RTM+2LM+2TK+2TM*RTM+2L@(" @(" @(" @(" @(" @(" @(" @
  2732. XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @"B @(" @(" @(" @(" @
  2733. XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
  2734. XM(" @(" @(" @(" @(" *(" @(" @(" K+2TM*RTM+2LM+2TK+2TM*RTM+2LM
  2735. XM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2L@(" @(" @( H@
  2736. XM(" @(" @('PU."!\-3D@?#8P('PV,2!\-C(@?#8S('PV-"!\-C4@?#8V('PV
  2737. XM-R!\-C@@?#8Y('PW,"!\-S$@?" @(" @(" @"B @(" @(" @?$-E('Q0<B!\
  2738. XM3F0@?%!M('Q3;2!\174@?$=D('Q48B!\1'D@?$AO('Q%<B!\5&T@?%EB('Q,
  2739. XM=2!\(" @(" @(" *(" @(" @("!\,30P?#$T,7PQ-#1\,30U?#$U,'PQ-3)\
  2740. XM,34W?#$U.7PQ-C)\,38U?#$V-WPQ-CE\,3<S?#$W-7P@(" @(" @( H@(" @
  2741. XM(" @("LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK
  2742. XM+2TM*RTM+2LM+2TK+2TM*R @(" @(" @"B @(" @(" @?#DP('PY,2!\.3(@
  2743. XM?#DS('PY-"!\.34@?#DV('PY-R!\.3@@?#DY('PQ,#!\,3 Q?#$P,GPQ,#-\
  2744. XM(" @(" @(" *(" @(" @("!\5&@@?%!A('Q5("!\3G @?%!U('Q!;2!\0VT@
  2745. XM?$)K('Q#9B!\17,@?$9M('Q-9"!\3F\@?$QR('P@(" @(" @( H@(" @(" @
  2746. XM('PR,S)\,C,Q?#(S.'PR,S=\,C0T?#(T,WPR-#=\,C0W?#(U,7PR-31\,C4W
  2747. XM?#(U-GPR-31\,C4W?" @(" @(" @"B @(" @(" @*RTM+2LM+2TK+2TM*RTM
  2748. XM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK(" @
  2749. X&(" @(" *
  2750. Xend
  2751. //E*O*F ./1988/isaak.encode//
  2752.  
  2753. echo x - ./1988/isaak.hint
  2754. sed -e 's/^X//' > "./1988/isaak.hint" << '//E*O*F ./1988/isaak.hint//'
  2755. XBest visuals: <imagen!isaak> Mark Isaak
  2756. X
  2757. X        Mark Isaak
  2758. X    Imagen Corporation
  2759. X    2650 San Tomas Expy.
  2760. X    Santa Clara, CA 
  2761. X    95052-8101
  2762. X    USA
  2763. X
  2764. XCompile with:
  2765. X
  2766. X    cc -DI=B -DO=- -Dy isaak.c -o isaak
  2767. X
  2768. XExecute without arguments.
  2769. X
  2770. XThe original entry starts with the line:
  2771. X
  2772. X    main(){};
  2773. X
  2774. XThis works on some 4.3BSD systems.  Why?  Note that #include <stdio.h>
  2775. Xis given on the last line.  Why is this needed?  Note the unusual calls
  2776. Xto sprintf.
  2777. X
  2778. XNOTE:  The program relies heavily on ASCII.  Don't even think of
  2779. X       running it on an EBCDIC machine.  If you name the file anything 
  2780. X       other than "isaak.c", you must change the #include on line 7.
  2781. X
  2782. XNOTE: The use of null comments to separate macros to construct different 
  2783. X      tokens from a single macro (e.g., "O/**/O" creates either "++" or "--" 
  2784. X      by defining "O" to be "+" or "-") may cause some strict ANSI
  2785. X      C preprocessors to object.
  2786. X
  2787. XNOTE: Most System V machines will not be able to execute this program
  2788. X      correctly due to the fact that BSD style systems have an sprintf()
  2789. X      that returns a char *.
  2790. X
  2791. XDue to the above problems, we have replaced the output of this program
  2792. Xin the file: isaak.encode.  To read this file do:
  2793. X
  2794. X    uudecode < isaak.encode
  2795. X    cat isaak.output
  2796. X
  2797. XFYI: We are likely to be more strict about portability in the future.
  2798. //E*O*F ./1988/isaak.hint//
  2799.  
  2800. echo x - ./1988/litmaath.c
  2801. sed -e 's/^X//' > "./1988/litmaath.c" << '//E*O*F ./1988/litmaath.c//'
  2802. Xmain(argc, argv)
  2803. Xint    argc;
  2804. Xchar    **argv;
  2805. X{
  2806. X    while (*argv != argv[1] && (*argv = argv[1]) && (argc = 0) || (*++argv
  2807. X        && (**argv && ((++argc)[*argv] && (**argv <= argc[*argv] ||
  2808. X        (**argv += argc[*argv] -= **argv = argc[*argv] - **argv)) &&
  2809. X        --argv || putchar(**argv) && ++*argv--) || putchar(10))))
  2810. X        ;
  2811. X}
  2812. //E*O*F ./1988/litmaath.c//
  2813.  
  2814. echo x - ./1988/litmaath.hint
  2815. sed -e 's/^X//' > "./1988/litmaath.hint" << '//E*O*F ./1988/litmaath.hint//'
  2816. XBest small program: <cs.vu.nl!maart> Maarten Litmaath
  2817. X
  2818. X    Maarten Litmaath
  2819. X    Free University (VU) Amsterdam
  2820. X    Department of computer science
  2821. X    Uilenstede 72
  2822. X    1183 AK Amstelveen
  2823. X    The Netherlands
  2824. X
  2825. XTry: litmaath eschew obfuscation
  2826. X
  2827. XNote the unusual structure:
  2828. X
  2829. X     while (<condition>)
  2830. X         ;
  2831. X
  2832. XDid you notice that the body is empty?
  2833. X
  2834. XThe best one can do to understand how the program works is to give it
  2835. Xtwo small strings as arguments, and follow the program closely.  One
  2836. Xcould make the body of the 'while' loop an 'fprintf' with interesting
  2837. Xvariables like:
  2838. X
  2839. X    fprintf(stderr,
  2840. X         "argv=%lo *argv=%lo **argv=%c argv[1]=%lo *argv[1]=%c argc=%d\n",
  2841. X         (long) argv, (long) *argv, *argv && **argv ? **argv : '@',
  2842. X         (long) argv[1], argv[1] && *argv[1] ? *argv[1] : '@', argc);
  2843. X
  2844. XFurthermore, it's interesting to note that only two variables are
  2845. Xused to achieve everything.
  2846. //E*O*F ./1988/litmaath.hint//
  2847.  
  2848. echo x - ./1988/phillipps.c
  2849. sed -e 's/^X//' > "./1988/phillipps.c" << '//E*O*F ./1988/phillipps.c//'
  2850. Xmain(t,_,a )
  2851. Xchar
  2852. X*
  2853. Xa;
  2854. X{
  2855. X                return!
  2856. X
  2857. X0<t?
  2858. Xt<3?
  2859. X
  2860. Xmain(-79,-13,a+
  2861. Xmain(-87,1-_,
  2862. Xmain(-86, 0, a+1 )
  2863. X
  2864. X
  2865. X+a)):
  2866. X
  2867. X1,
  2868. Xt<_?
  2869. Xmain( t+1, _, a )
  2870. X:3,
  2871. X
  2872. Xmain ( -94, -27+t, a )
  2873. X&&t == 2 ?_
  2874. X<13 ?
  2875. X
  2876. Xmain ( 2, _+1, "%s %d %d\n" )
  2877. X
  2878. X:9:16:
  2879. Xt<0?
  2880. Xt<-72?
  2881. Xmain( _, t,
  2882. X"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# ){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c ;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;#'rdq#w! nr'/ ') }+}{rl#'{n' ')# }'+}##(!!/")
  2883. X:
  2884. Xt<-50?
  2885. X_==*a ?
  2886. Xputchar(31[a]):
  2887. X
  2888. Xmain(-65,_,a+1)
  2889. X:
  2890. Xmain((*a == '/') + t, _, a + 1 )
  2891. X:
  2892. X
  2893. X0<t?
  2894. X
  2895. Xmain ( 2, 2 , "%s")
  2896. X:*a=='/'||
  2897. X
  2898. Xmain(0,
  2899. X
  2900. Xmain(-61,*a, "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry")
  2901. X
  2902. X,a+1);}
  2903. //E*O*F ./1988/phillipps.c//
  2904.  
  2905. echo x - ./1988/phillipps.hint
  2906. sed -e 's/^X//' > "./1988/phillipps.hint" << '//E*O*F ./1988/phillipps.hint//'
  2907. XLeast likely to compile successfully: <camcom!igp> Ian Phillipps 
  2908. X
  2909. X    Ian Phillipps
  2910. X    Cambridge Consultants Ltd
  2911. X    Science Park
  2912. X    Milton Road
  2913. X    Cambridge CB4 4DW
  2914. X    England
  2915. X
  2916. XCompile and run without parameters.
  2917. X
  2918. XThe program is smaller than even the 'compressed' form of its output,
  2919. Xand thus represents a new departure in text compression standards.
  2920. X
  2921. XThe judges thought that this program looked like what you would get
  2922. Xby pounding on the keys of an old typewriter at random.
  2923. //E*O*F ./1988/phillipps.hint//
  2924.  
  2925. echo x - ./1988/reddy.c
  2926. sed -e 's/^X//' > "./1988/reddy.c" << '//E*O*F ./1988/reddy.c//'
  2927. X#include<stdio.h>
  2928. X#include<ctype.h>
  2929. X#define w printf
  2930. X#define p while
  2931. X#define t(s) (W=T(s))
  2932. Xchar*X,*B,*L,I[99];M,W,V;D(){W==9?(w("`%.*s' is ",V,X),t(0)):W==40?(t(0),D(),t(41)):W==42?(t(0),D(),w("ptr to ")):0;p(W==40?(t(0),w("func returning "),t(41)):W==91?(t(0)==32?(w("array[0..%d] of ",atoi(X)-1),t(0)):w("array of "),t(93)):0);}main(){p(w("input: "),B=gets(I))if(t(0)==9)L=X,M=V,t(0),D(),w("%.*s.\n\n",M,L);}T(s){if(!s||s==W){p(*B==9||*B==32)B++;X=B;V=0;if(W=isalpha(*B)?9:isdigit(*B)?32:*B++)if(W<33)p(isalnum(*B))B++,V++;}return W;}
  2933. //E*O*F ./1988/reddy.c//
  2934.  
  2935. echo x - ./1988/reddy.hint
  2936. sed -e 's/^X//' > "./1988/reddy.hint" << '//E*O*F ./1988/reddy.hint//'
  2937. XMost useful Obfuscated C program: <> Gopi Reddy
  2938. X
  2939. X    Amperif Corporation
  2940. X    9232 Eton Avenue
  2941. X    Chatsworth, CA
  2942. X    91311
  2943. X    U.S.A.
  2944. X
  2945. X
  2946. XCompile and give the following line as input:
  2947. X
  2948. X    char *(*(fun[16])();
  2949. X
  2950. XThis is a somewhat restricted version of a useful program that has been
  2951. Xposted to Usenet.  What is unusual is what it is able to do so much
  2952. Xin such little space.
  2953. //E*O*F ./1988/reddy.hint//
  2954.  
  2955. echo x - ./1988/robison.c
  2956. sed -e 's/^X//' > "./1988/robison.c" << '//E*O*F ./1988/robison.c//'
  2957. X#include <stdio.h>
  2958. Xunsigned char w,h,i,l,e,x,y=10,z=10,E[256];
  2959. X#define whi1e(j,k)  printf(j,k); fflush(stdout)
  2960. X#define o E[w]
  2961. X
  2962. Xmain    (c,v)    char *v[]; {
  2963. Xwhile    (c>=2    ){z = atoi(v[1]),--c;
  2964. Xwhile     (c>=2    )y = atoi(v[2]),--c;}
  2965. Xwhi1e    ("%s"    ,"2.");
  2966. Xwhile    (--y)    --x;
  2967. Xwhile    (--x)    --e,--y;
  2968. Xwhile    (--z)    --x;
  2969. Xwhile    (--x)    --e,--z;
  2970. Xwhile    (--w)    {
  2971. Xwhile    (--x)    --o;}
  2972. Xwhile    (--z)    {
  2973. Xwhile    (--x)    --w;
  2974. Xwhile    (--o)    ;
  2975. Xwhile    (--w)    ;
  2976. Xwhile    (--e)    --x;
  2977. Xwhile    (--x)    --w,--e;
  2978. Xwhile    (--w)    {
  2979. Xwhile    (--l)    ;
  2980. Xwhile    (--i)    --l;--l;
  2981. Xwhile    (--h)    ;
  2982. Xwhile    (--y)    --x;
  2983. Xwhile    (--x)    --h,--y;
  2984. Xwhile    (--x)    --h;
  2985. Xwhile    (--h)    {
  2986. Xwhile    (--o)    --x;
  2987. Xwhile    (--x)    --l,--o;
  2988. Xwhile    (l>=w    ){--i;
  2989. Xwhile    (--w)    --l,--x;
  2990. Xwhile    (--x)    --w;--l;}}
  2991. Xwhile    (--o)    ;
  2992. Xwhile    (--l)    --x;
  2993. Xwhile    (--x)    --o;}
  2994. Xwhile    (--i)    --h;
  2995. Xwhi1e    ("%x"    ,--h);--e;}
  2996. Xwhi1e    ("%s"    ,"\n");}
  2997. //E*O*F ./1988/robison.c//
  2998.  
  2999. echo x - ./1988/robison.hint
  3000. sed -e 's/^X//' > "./1988/robison.hint" << '//E*O*F ./1988/robison.hint//'
  3001. XBest abuse of C constructs: <robison@m.cs.uiuc.edu> Arch D. Robison
  3002. X
  3003. X        Arch D. Robison
  3004. X    University of Illinois at Urbana-Champaign
  3005. X    1304 W. Springfield Ave.
  3006. X    Urbana IL 
  3007. X    61801
  3008. X    USA
  3009. X
  3010. XTry: robison 80 10
  3011. X     robison 40 16
  3012. X
  3013. XThe first and second parameters are optional.  You might also try:
  3014. X
  3015. X     robison 80 2   <--- can you find the bug?
  3016. X     robison 80 -246
  3017. X
  3018. XThe author says:
  3019. X
  3020. X    This program shows that C has many unnecessary constructs, in fact
  3021. X    only "while","--", and ">=" are required.  (The two assignments at
  3022. X    the beginning could be avoided if "atoi" was rewritten with this
  3023. X    new paradigm.)  Note that the lack of both the controversial "goto"
  3024. X    and assignment statements make the meaning crystal clear.  The current 
  3025. X    ANSI committee should look into this practical simplification of C.
  3026. X
  3027. XThe following might make an interesting benchmark:
  3028. X
  3029. X     robison 100    
  3030. X
  3031. X[Amdahl 5890-300E with System V cc: 8.40 seconds]
  3032. X
  3033. XWe suggest that you C preprocess and perhaps C-beautify this program.
  3034. XAll is not what it may appear to be in this program.  When does a whi1e
  3035. Xnot take a while to execute?
  3036. //E*O*F ./1988/robison.hint//
  3037.  
  3038. echo x - ./1988/rules
  3039. sed -e 's/^X//' > "./1988/rules" << '//E*O*F ./1988/rules//'
  3040. XSubject: 5th International Obfuscated C Code Contest Rules
  3041. XNewsgroups: comp.lang.c,comp.unix.wizards
  3042. XKeywords: rules,1988,obfuscate,contest
  3043. X
  3044. X    Obfuscate:  tr.v.  -cated, -cating, -cates.  1. a.  To render obscure.
  3045. X        b.  To darken.  2. To confuse:  his emotions obfuscated his
  3046. X        judgement.  [LLat. obfuscare, to darken : ob(intensive) +
  3047. X        Lat. fuscare, to darken < fuscus, dark.] -obfuscation n.
  3048. X        obfuscatory adj.
  3049. X
  3050. XGOALS OF THE CONTEST:
  3051. X
  3052. X    * To write the most Obscure/Obfuscated C program under the rules below.
  3053. X    * To show what should NOT be done in C programs.
  3054. X    * To provide a safe forum for poor C code.  :-)
  3055. X
  3056. XRULES:
  3057. X
  3058. X    To help us handle the vast volume of entries, we ask that you
  3059. X    follow the rules below.  Sorry for the length, but we need all
  3060. X    the help we can get!
  3061. X
  3062. X    1) Your source MUST be 1536 bytes or less, and it must be a complete
  3063. X       program, not just a subroutine.  NOTE the new maximum size.
  3064. X
  3065. X    2) To help us process your entries, we ask that you submit entries
  3066. X       in the following format.  Please be sure to include the --- lines,
  3067. X       otherwise our extraction program may skip your entry!
  3068. X
  3069. X---header items---
  3070. Xname:        Your name, of course!
  3071. Xorg:        School/Company/Organization
  3072. Xemail address:    Email address from a well known site
  3073. Xpostal address:    Postal address, include your country as well
  3074. Xenvironment:    Indicate the Hardware & OS under which your program was tested
  3075. Xentry:        A of B        <entry number such as 3 of 5, 1 of 1...>
  3076. Xremarks:            <see below>
  3077. X---how to compile---
  3078. XX Give the command(s) needed to compile your program.
  3079. XX Follow the same rules as given for the program below except that the
  3080. XX command size must be 160 characters or less.
  3081. X---program---
  3082. XX Place obfuscated source of 1536 characters or less in this section.
  3083. XX Add a leading X to each line to avoid problems with mailers.
  3084. XX Some mailers don't like files with very long lines.  If your entry contains C
  3085. XC    lines longer 80 chars we ask you to form continuation line sets.  To form C
  3086. XC    a continuation line set, place a 'C' character at the point of a split C
  3087. XC    and place a C (instead of an X) at the beginning of the next line. C
  3088. XC    Finally, end the continuation line set as normal.
  3089. XX The C\nC's and leading X's will be removed prior to extraction and thus C
  3090. XC    they don't contribute toward the source character count.  All other C
  3091. XC    characters are considered to be source.
  3092. XX Newlines count as 1 character.  Assume a standard 8 character tab stop.
  3093. X---end---
  3094. X
  3095. X    3) Regarding the header items:
  3096. X
  3097. X        * Any text outside of the above format will be kept confidential.
  3098. X
  3099. X        * All header lines are required, but you may use 'annonymous'
  3100. X          for any header line other than 'remarks' or 'entry'.
  3101. X
  3102. X        * In the 'remarks' please include:
  3103. X        - what this program does
  3104. X        - why you think the program is obfuscated
  3105. X        - any other remarks you wish to make
  3106. X
  3107. X    4) Your entry should be written in common C. (K&R + common extensions)
  3108. X       Due to the lack of ANSI C compilers, it is suggested, but not
  3109. X       required, that you avoid use of constructs unque to ANSI C.
  3110. X
  3111. X    5) The program must be of original work.  All programs must be
  3112. X       in the public domain.  All copyrighted programs will be rejected.
  3113. X
  3114. X    6) Entries must be received between 15-Mar-88 0:00 GMT and 
  3115. X       25-May-88 0:00 GMT.  Email your entries to:
  3116. X       
  3117. X            ...!amdahl!obfuscate
  3118. X
  3119. X       Amdahl talks to hplabs, decwrl, pyramid, sun, uunet, cbosgd, ...
  3120. X       We will attempt to Email a confirmation of receipt of contest
  3121. X       entries, however since Email is not reliable you may not receive it.
  3122. X       People are strongly encouraged to submit entries via Email, however
  3123. X       one may mail entries the following postal address:
  3124. X
  3125. X        Landon Curt Noll
  3126. X        Amdahl Corp.
  3127. X        1250 E. Arques Ave.   M/S 316
  3128. X        P.O. Box 3470
  3129. X        Sunnyvale, CA
  3130. X        94088-3470
  3131. X        U.S.A.
  3132. X
  3133. X      Write the words: "International Obfuscated C Code Contest" near the
  3134. X      bottom left corner of the envelope.
  3135. X
  3136. X    7) Each person may submit up to 8 entries.  Multiple entries must
  3137. X       be sent in separate Email letters or postal envelopes.
  3138. X
  3139. X
  3140. XANNOUNCEMENT OF WINNERS:
  3141. X
  3142. X    * First announcement will be at the Summer 88 Usenix BOF.
  3143. X
  3144. X    * Winning entries will be posted to comp.sources.unix
  3145. X      as well as news groups where these rule